Magento 2 : Default billing address not selected by default on checkout page Planned...

How could we fake a moon landing now?

Is there a kind of relay only consumes power when switching?

Time to Settle Down!

Effects on objects due to a brief relocation of massive amounts of mass

What is this clumpy 20-30cm high yellow-flowered plant?

Find 108 by using 3,4,6

Can anything be seen from the center of the Boötes void? How dark would it be?

What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

How does the math work when buying airline miles?

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

Sum letters are not two different

Did Deadpool rescue all of the X-Force?

Why do we need to use the builder design pattern when we can do the same thing with setters?

How to install press fit bottom bracket into new frame

Why aren't air breathing engines used as small first stages?

Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

What would you call this weird metallic apparatus that allows you to lift people?

Crossing US/Canada Border for less than 24 hours

Should I follow up with an employee I believe overracted to a mistake I made?

The code below, is it ill-formed NDR or is it well formed?

What do you call the main part of a joke?

What does it mean that physics no longer uses mechanical models to describe phenomena?



Magento 2 : Default billing address not selected by default on checkout page



Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?M2.2.4 Checkout: Adding New Shipping Address automatically sets address as Billing AddressHow to restrict onepage checkout to not load address same as billing when select “Ship to different address” on frontend?How to check billing and shipping address are sameMove billing address form to shipping address page in magento 2.1Move “My billing and shipping address are the same” to shipping sectionMagento 2 : Remove Billing Address From Payment Step in CheckoutChange default behaviour for address selection in checkoutMagento2 remove some addresses on checkout page when selecting shipping addressMagento 2 Setting a address as DefaultM2.2.4 Checkout: Adding New Shipping Address automatically sets address as Billing AddressMagento 2 how to dispaly billing address in opc-sidebar in checkout page





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I am using Magento 2.0.7 and my default billing and shipping address are different in My account Address section.



When I am going on checkout page my default shipping address selected by default and I move on payment section but on payment section My shipping address by default set as billing address.




I already mention default billing address then how we get that address selected by default ?











share|improve this question
















bumped to the homepage by Community 11 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Hi did you get a solution for this?

    – Geethika Antony
    Mar 16 '17 at 4:54











  • Hi Ashish, I face some different kind of problem but If you can write the solution of this than it's may be its help full.

    – jaydip sinh Parmar
    Sep 12 '17 at 6:55


















1















I am using Magento 2.0.7 and my default billing and shipping address are different in My account Address section.



When I am going on checkout page my default shipping address selected by default and I move on payment section but on payment section My shipping address by default set as billing address.




I already mention default billing address then how we get that address selected by default ?











share|improve this question
















bumped to the homepage by Community 11 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Hi did you get a solution for this?

    – Geethika Antony
    Mar 16 '17 at 4:54











  • Hi Ashish, I face some different kind of problem but If you can write the solution of this than it's may be its help full.

    – jaydip sinh Parmar
    Sep 12 '17 at 6:55














1












1








1








I am using Magento 2.0.7 and my default billing and shipping address are different in My account Address section.



When I am going on checkout page my default shipping address selected by default and I move on payment section but on payment section My shipping address by default set as billing address.




I already mention default billing address then how we get that address selected by default ?











share|improve this question
















I am using Magento 2.0.7 and my default billing and shipping address are different in My account Address section.



When I am going on checkout page my default shipping address selected by default and I move on payment section but on payment section My shipping address by default set as billing address.




I already mention default billing address then how we get that address selected by default ?








magento2 checkout shipping-address billing-address






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 9 '17 at 7:25







Ashish Jagnani

















asked Oct 4 '16 at 4:52









Ashish JagnaniAshish Jagnani

4,59721956




4,59721956





bumped to the homepage by Community 11 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 11 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Hi did you get a solution for this?

    – Geethika Antony
    Mar 16 '17 at 4:54











  • Hi Ashish, I face some different kind of problem but If you can write the solution of this than it's may be its help full.

    – jaydip sinh Parmar
    Sep 12 '17 at 6:55



















  • Hi did you get a solution for this?

    – Geethika Antony
    Mar 16 '17 at 4:54











  • Hi Ashish, I face some different kind of problem but If you can write the solution of this than it's may be its help full.

    – jaydip sinh Parmar
    Sep 12 '17 at 6:55

















Hi did you get a solution for this?

– Geethika Antony
Mar 16 '17 at 4:54





Hi did you get a solution for this?

– Geethika Antony
Mar 16 '17 at 4:54













Hi Ashish, I face some different kind of problem but If you can write the solution of this than it's may be its help full.

– jaydip sinh Parmar
Sep 12 '17 at 6:55





Hi Ashish, I face some different kind of problem but If you can write the solution of this than it's may be its help full.

– jaydip sinh Parmar
Sep 12 '17 at 6:55










2 Answers
2






active

oldest

votes


















0














You could do the following:




  • overwrite a default js file checkout-data-resolver.js

  • add extra lines to the applyBillingAddress function to check if default
    billing address exists and if true to use it


step 1. Overwritting a default magento checkout-data-resolver.js




  • 1.1 Create your module. YourCompanyCheckout


  • 1.2 Add file appcodeYourCompanyCheckoutviewfrontendrequirejs-config.js



with following content



var config = {
map: {
'*': {
'Magento_Checkout/js/model/checkout-data-resolver':
'YourCompany_Checkout/js/model/checkout-data-resolver'
}
}

};



  • 1.3 Copy magento file vendormagentomodule-checkoutviewfrontendwebjsmodelcheckout-data-resolver.js
    to the destination
    appcodeYourCompanyCheckoutviewfrontendwebjsmodelcheckout-data-resolver.js


step 2. Modify applyBillingAddress function



2.1 in new checkout-data-resolver.js file find applyBillingAddress. Insert following cod after var shippingAddress; and before if (quote.billingAddress())



....
var isBillingAddressInitialized;
isBillingAddressInitialized = addressList.some(function (addressFromList) {
if (addressFromList.isDefaultBilling()) {
selectBillingAddress(addressFromList);
return true;
}

return false;
});

if(isBillingAddressInitialized){
return;
}
....


This code actually goes through customer addresses and checks if any of them has defaultBilling set to true. If such an address exists it will be used as the billing address. If not the script will fall back to the default magento behavior






share|improve this answer
























  • I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

    – ne0nlight
    Oct 10 '18 at 19:40



















0














I got solution of this problem.
please check your theme override file:




/app/design/frontend/Vendor/your-theme/Magento_Checkout/web/js/view/shipping.js




in this file checkout your custom code on line no 114 or may be change of this line your file. So, checkout this function



initialize: function ()


Inside this function check following code



 registry.async('checkoutProvider')(function (checkoutProvider) {
//////////
Your Code
/////////
});


from this jQuery remove your custom code or update with new code.



hope it will work for you. In my case it is working for me after update this function.



Thanks






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139195%2fmagento-2-default-billing-address-not-selected-by-default-on-checkout-page%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You could do the following:




    • overwrite a default js file checkout-data-resolver.js

    • add extra lines to the applyBillingAddress function to check if default
      billing address exists and if true to use it


    step 1. Overwritting a default magento checkout-data-resolver.js




    • 1.1 Create your module. YourCompanyCheckout


    • 1.2 Add file appcodeYourCompanyCheckoutviewfrontendrequirejs-config.js



    with following content



    var config = {
    map: {
    '*': {
    'Magento_Checkout/js/model/checkout-data-resolver':
    'YourCompany_Checkout/js/model/checkout-data-resolver'
    }
    }

    };



    • 1.3 Copy magento file vendormagentomodule-checkoutviewfrontendwebjsmodelcheckout-data-resolver.js
      to the destination
      appcodeYourCompanyCheckoutviewfrontendwebjsmodelcheckout-data-resolver.js


    step 2. Modify applyBillingAddress function



    2.1 in new checkout-data-resolver.js file find applyBillingAddress. Insert following cod after var shippingAddress; and before if (quote.billingAddress())



    ....
    var isBillingAddressInitialized;
    isBillingAddressInitialized = addressList.some(function (addressFromList) {
    if (addressFromList.isDefaultBilling()) {
    selectBillingAddress(addressFromList);
    return true;
    }

    return false;
    });

    if(isBillingAddressInitialized){
    return;
    }
    ....


    This code actually goes through customer addresses and checks if any of them has defaultBilling set to true. If such an address exists it will be used as the billing address. If not the script will fall back to the default magento behavior






    share|improve this answer
























    • I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

      – ne0nlight
      Oct 10 '18 at 19:40
















    0














    You could do the following:




    • overwrite a default js file checkout-data-resolver.js

    • add extra lines to the applyBillingAddress function to check if default
      billing address exists and if true to use it


    step 1. Overwritting a default magento checkout-data-resolver.js




    • 1.1 Create your module. YourCompanyCheckout


    • 1.2 Add file appcodeYourCompanyCheckoutviewfrontendrequirejs-config.js



    with following content



    var config = {
    map: {
    '*': {
    'Magento_Checkout/js/model/checkout-data-resolver':
    'YourCompany_Checkout/js/model/checkout-data-resolver'
    }
    }

    };



    • 1.3 Copy magento file vendormagentomodule-checkoutviewfrontendwebjsmodelcheckout-data-resolver.js
      to the destination
      appcodeYourCompanyCheckoutviewfrontendwebjsmodelcheckout-data-resolver.js


    step 2. Modify applyBillingAddress function



    2.1 in new checkout-data-resolver.js file find applyBillingAddress. Insert following cod after var shippingAddress; and before if (quote.billingAddress())



    ....
    var isBillingAddressInitialized;
    isBillingAddressInitialized = addressList.some(function (addressFromList) {
    if (addressFromList.isDefaultBilling()) {
    selectBillingAddress(addressFromList);
    return true;
    }

    return false;
    });

    if(isBillingAddressInitialized){
    return;
    }
    ....


    This code actually goes through customer addresses and checks if any of them has defaultBilling set to true. If such an address exists it will be used as the billing address. If not the script will fall back to the default magento behavior






    share|improve this answer
























    • I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

      – ne0nlight
      Oct 10 '18 at 19:40














    0












    0








    0







    You could do the following:




    • overwrite a default js file checkout-data-resolver.js

    • add extra lines to the applyBillingAddress function to check if default
      billing address exists and if true to use it


    step 1. Overwritting a default magento checkout-data-resolver.js




    • 1.1 Create your module. YourCompanyCheckout


    • 1.2 Add file appcodeYourCompanyCheckoutviewfrontendrequirejs-config.js



    with following content



    var config = {
    map: {
    '*': {
    'Magento_Checkout/js/model/checkout-data-resolver':
    'YourCompany_Checkout/js/model/checkout-data-resolver'
    }
    }

    };



    • 1.3 Copy magento file vendormagentomodule-checkoutviewfrontendwebjsmodelcheckout-data-resolver.js
      to the destination
      appcodeYourCompanyCheckoutviewfrontendwebjsmodelcheckout-data-resolver.js


    step 2. Modify applyBillingAddress function



    2.1 in new checkout-data-resolver.js file find applyBillingAddress. Insert following cod after var shippingAddress; and before if (quote.billingAddress())



    ....
    var isBillingAddressInitialized;
    isBillingAddressInitialized = addressList.some(function (addressFromList) {
    if (addressFromList.isDefaultBilling()) {
    selectBillingAddress(addressFromList);
    return true;
    }

    return false;
    });

    if(isBillingAddressInitialized){
    return;
    }
    ....


    This code actually goes through customer addresses and checks if any of them has defaultBilling set to true. If such an address exists it will be used as the billing address. If not the script will fall back to the default magento behavior






    share|improve this answer













    You could do the following:




    • overwrite a default js file checkout-data-resolver.js

    • add extra lines to the applyBillingAddress function to check if default
      billing address exists and if true to use it


    step 1. Overwritting a default magento checkout-data-resolver.js




    • 1.1 Create your module. YourCompanyCheckout


    • 1.2 Add file appcodeYourCompanyCheckoutviewfrontendrequirejs-config.js



    with following content



    var config = {
    map: {
    '*': {
    'Magento_Checkout/js/model/checkout-data-resolver':
    'YourCompany_Checkout/js/model/checkout-data-resolver'
    }
    }

    };



    • 1.3 Copy magento file vendormagentomodule-checkoutviewfrontendwebjsmodelcheckout-data-resolver.js
      to the destination
      appcodeYourCompanyCheckoutviewfrontendwebjsmodelcheckout-data-resolver.js


    step 2. Modify applyBillingAddress function



    2.1 in new checkout-data-resolver.js file find applyBillingAddress. Insert following cod after var shippingAddress; and before if (quote.billingAddress())



    ....
    var isBillingAddressInitialized;
    isBillingAddressInitialized = addressList.some(function (addressFromList) {
    if (addressFromList.isDefaultBilling()) {
    selectBillingAddress(addressFromList);
    return true;
    }

    return false;
    });

    if(isBillingAddressInitialized){
    return;
    }
    ....


    This code actually goes through customer addresses and checks if any of them has defaultBilling set to true. If such an address exists it will be used as the billing address. If not the script will fall back to the default magento behavior







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 27 '18 at 8:05









    Михаил КрыловМихаил Крылов

    11




    11













    • I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

      – ne0nlight
      Oct 10 '18 at 19:40



















    • I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

      – ne0nlight
      Oct 10 '18 at 19:40

















    I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

    – ne0nlight
    Oct 10 '18 at 19:40





    I'm running into a similar issue, but only when I add a new address in the shipping step prior to going to the payment step, it ends up taking the new shipping address and automatically changing the default billing address to the new shipping address. Any idea what could cause that? I tried this fix, however the issue persists.

    – ne0nlight
    Oct 10 '18 at 19:40













    0














    I got solution of this problem.
    please check your theme override file:




    /app/design/frontend/Vendor/your-theme/Magento_Checkout/web/js/view/shipping.js




    in this file checkout your custom code on line no 114 or may be change of this line your file. So, checkout this function



    initialize: function ()


    Inside this function check following code



     registry.async('checkoutProvider')(function (checkoutProvider) {
    //////////
    Your Code
    /////////
    });


    from this jQuery remove your custom code or update with new code.



    hope it will work for you. In my case it is working for me after update this function.



    Thanks






    share|improve this answer




























      0














      I got solution of this problem.
      please check your theme override file:




      /app/design/frontend/Vendor/your-theme/Magento_Checkout/web/js/view/shipping.js




      in this file checkout your custom code on line no 114 or may be change of this line your file. So, checkout this function



      initialize: function ()


      Inside this function check following code



       registry.async('checkoutProvider')(function (checkoutProvider) {
      //////////
      Your Code
      /////////
      });


      from this jQuery remove your custom code or update with new code.



      hope it will work for you. In my case it is working for me after update this function.



      Thanks






      share|improve this answer


























        0












        0








        0







        I got solution of this problem.
        please check your theme override file:




        /app/design/frontend/Vendor/your-theme/Magento_Checkout/web/js/view/shipping.js




        in this file checkout your custom code on line no 114 or may be change of this line your file. So, checkout this function



        initialize: function ()


        Inside this function check following code



         registry.async('checkoutProvider')(function (checkoutProvider) {
        //////////
        Your Code
        /////////
        });


        from this jQuery remove your custom code or update with new code.



        hope it will work for you. In my case it is working for me after update this function.



        Thanks






        share|improve this answer













        I got solution of this problem.
        please check your theme override file:




        /app/design/frontend/Vendor/your-theme/Magento_Checkout/web/js/view/shipping.js




        in this file checkout your custom code on line no 114 or may be change of this line your file. So, checkout this function



        initialize: function ()


        Inside this function check following code



         registry.async('checkoutProvider')(function (checkoutProvider) {
        //////////
        Your Code
        /////////
        });


        from this jQuery remove your custom code or update with new code.



        hope it will work for you. In my case it is working for me after update this function.



        Thanks







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 10:15









        SarfarajSarfaraj

        405518




        405518






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139195%2fmagento-2-default-billing-address-not-selected-by-default-on-checkout-page%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

            How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

            夢乃愛華...