2

I want to apply a functionality that enables , dynamic billing address to be changed as per changing shipping address in checkout page magento 2. How to get shipping address from quote object in custom js file magento 2 ?

Appreciate your help.

0

You can access the shipping address from the quote js model in your custom js file.

Use below code to access shipping address in your custom js file:

define(
        [
            'ko',
            'Magento_Checkout/js/model/quote'
        ],
        function (
                ko,
                quote
                ) {
            'use strict';

            return {
                yourFunctionName: function () {

                    var shippingAddress = quote.shippingAddress();
                    var billingAddress = quote.billingAddress();
                }
            };
        }
);

Hope this helps!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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