6

I am having an issue where the box is being marked automatically. I want to unmark it.

enter image description here

  • Do you want to unchecked check-box and all input filed should visible all time ? Or it should take shipping value already filled ? – Pawan Sep 21 '18 at 3:34
1

Copy the following file to your theme:

vendor/magento/module-checkout/view/frontend/web/js/model/checkout-data-resolver.js

and comment out the lines like below:

applyBillingAddress: function () {
    var shippingAddress;

    if (quote.billingAddress()) {
        selectBillingAddress(quote.billingAddress());

        return;
    }
    shippingAddress = quote.shippingAddress();

    // This comment is for uncheck the billing address on payment page
    /*if (shippingAddress &&
        shippingAddress.canUseForBilling() &&
        (shippingAddress.isDefaultShipping() || !quote.isVirtual())
    ) {
        selectBillingAddress(quote.shippingAddress());
    }*/
}

And also copy the following file to your theme:

vendor/magento/module-checkout/view/frontend/web/js/model/shipping-save-processor/default.js

and comment out the lines like below:

saveShippingInformation: function () {
    var payload;

    // This comment is for uncheck the billing address on payment page
    /*if (!quote.billingAddress()) {
        selectBillingAddressAction(quote.shippingAddress());
    }*/

    payload = {
        addressInformation: {
            'shipping_address': quote.shippingAddress(),
            'billing_address': quote.billingAddress(),
            'shipping_method_code': quote.shippingMethod()['method_code'],
            'shipping_carrier_code': quote.shippingMethod()['carrier_code']
        }
    };

    payloadExtender(payload);

    fullScreenLoader.startLoader();

    return storage.post(
        resourceUrlManager.getUrlForSetShippingInformation(quote),
        JSON.stringify(payload)
    ).done(
        function (response) {
            quote.setTotals(response.totals);
            paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
            fullScreenLoader.stopLoader();
        }
    ).fail(
        function (response) {
            errorProcessor.process(response);
            fullScreenLoader.stopLoader();
        }
    );
}

Don't forget to run static-content:deploy and cache flush.

  • That did not work. @sukumargorai – DevAnd Jul 12 '18 at 17:17
  • The checkbox was still marked – DevAnd Jul 12 '18 at 17:17
  • Flush the cache. Delete the pub/static/front-end and then run static content deploy. It should work. – Sukumar Gorai Jul 12 '18 at 17:18
  • Do I have to delete the static/front-end? @sukumargorai – DevAnd Jul 12 '18 at 17:36
  • Yes may be updated file is not generating. If not then try to update the same on vendor and check it in private browser. – Sukumar Gorai Jul 12 '18 at 17:41

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.