Created
May 24, 2019 19:34
-
-
Save veritstudio/b02feb93cff3e54b6abbc89399f0ec1b to your computer and use it in GitHub Desktop.
Automatically check billing address same as shipping in Magento 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'jquery', | |
'Magento_Checkout/js/checkout-data', | |
'Magento_Checkout/js/model/quote' | |
],function ($, checkoutData, quote) { | |
'use strict'; | |
return function (Component) { | |
return Component.extend({ | |
initObservable: function () { | |
this._super() | |
.observe({ | |
isAddressSameAsShipping: !(quote.billingAddress() === undefined || checkoutData.getSelectedBillingAddress() === 'new-customer-address') | |
}); | |
return this; | |
} | |
}); | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
config: { | |
mixins: { | |
'Magento_Checkout/js/view/billing-address': { | |
'Magento_Checkout/js/view/billing-address-mixin': true | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment