0

I'm working on the OneStepCheckout and my problem is when I clicked on the place order button and the My billing and shipping address are the same checkbox is not changed (after filling the shipping address) then it gives me error for required billing address fields.

I'm trying to update/reload the billing address (if the My billing and shipping address are the same checkbox is clicked) when all the fields are filled in the shipping address form on the checkout page.

Can anyone help me with this.

Thanks in advance!!!

1 Answer 1

0

Used below code to update the billing address.

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

    /**
     * Update Billing Address
     */
    function updateBillingAddress(element) {
        if (quote.shippingAddress() && quote.billingAddress() && $("input[name='billing-address-same-as-shipping']:checked").val() !== undefined) {
            quote.billingAddress(quote.shippingAddress()); //this will set the billing address same as shipping address.
        }
    }

});

Hope it'll help someone having same issue :)

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.