I want to change default billing address position which is coming under the payment information, I need it before shipping address(same as magento 1).

Anyone have any idea to achieve it, Please help?


1 Answer 1


We need to modify applyBillingAddress function in vendor/magento/module-checkout/view/frontend/web/js/model/checkout-data-resolver.js around line 231:

And comment out this part:

/*                if (shippingAddress &&
                    shippingAddress.canUseForBilling() &&
                    (shippingAddress.isDefaultShipping() || !quote.isVirtual())
                ) {
And commend out code around line 34:

           if (!quote.billingAddress()) {

But we can't modify the core javascript files itself (Magento 2 best practices!).

Instead we will create a simple Magento 2 module and will create a file app/code/Vendor/Module/view/frontend/requirejs-config.js with the following content:

var config = {
map: {
'*': {

Then copy vendor/magento/module-checkout/view/frontend/web/js/model/checkout-data-resolver.js to app/code/Vendor/Module/view/frontend/web/js/checkout-data-resolver.js and comment out in app/code/Vendor/Module/view/frontend/web/js/checkout-data-resolver.js around line 231:

applyBillingAddress: function () { var shippingAddress;

if (quote.billingAddress()) {

shippingAddress = quote.shippingAddress();

/*if (shippingAddress &&
    shippingAddress.canUseForBilling() &&
    (shippingAddress.isDefaultShipping() || !quote.isVirtual())
) {

And copy vendor/magento/module-checkout/view/frontend/web/js/model/shipping-save-processor/default.js to app/code/Vendor/Module/view/frontend/web/js/shipping-save-processor/default.js and in app/code/Vendor/Module/view/frontend/web/js/shipping-save-processor/default.js comment out code around line 34:

'use strict';

return {
    saveShippingInformation: function () {
        var payload;

        /*if (!quote.billingAddress()) {

        payload = {
            addressInformation: {
                shipping_address: quote.shippingAddress(),
                billing_address: quote.billingAddress(),

After that delete pub/static/frontend folder regenerate your static content:

php bin/magento setup:static-content:deploy

Clear magento cache and you should be all set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.