0

Can we remove the checkbox and label called "My billing and shipping address are the same" during checkout in Magento2?

I don't want to allow customers to enter billing address there. All I need is to hide the checkbox with the label, can it be done? Please anyone help me.

1 Answer 1

5

Overwrite:

vendor/magento/module-checkout/view/frontend/web/template/billing-address.html

in your custom theme:

app/design/frontend/<customTheme>/<customTheme>/Magento_Checkout/web/template/billing-address.html

And remove:

<div class="billing-address-same-as-shipping-block field choice" data-bind="visible: canUseShippingAddress()">
    <input type="checkbox" name="billing-address-same-as-shipping"
           data-bind="checked: isAddressSameAsShipping, click: useShippingAddress, attr: {id: 'billing-address-same-as-shipping-' + getCode($parent)}"/>
    <label data-bind="attr: {for: 'billing-address-same-as-shipping-' + getCode($parent)}"><span
            data-bind="i18n: 'My billing and shipping address are the same'"></span></label>
</div>

So the overwritten file should be like this:

<div class="checkout-billing-address">

<!-- ko template: 'Magento_Checkout/billing-address/details' --><!-- /ko -->
<fieldset class="fieldset" data-bind="visible: !isAddressDetailsVisible()">
    <!-- ko template: 'Magento_Checkout/billing-address/list' --><!-- /ko -->
    <!-- ko template: 'Magento_Checkout/billing-address/form' --><!-- /ko -->
    <div class="actions-toolbar">
        <div class="primary">
            <button class="action action-update" type="button" data-bind="click: updateAddress">
                <span data-bind="i18n: 'Update'"></span>
            </button>
            <button class="action action-cancel" type="button" data-bind="click: cancelAddressEdit">
                <span data-bind="i18n: 'Cancel'"></span>
            </button>
        </div>
    </div>
</fieldset>

UPDATE:

In later versions of Magento, keeping line

<render args="detailsTemplate"/>

prior to

<fieldset class="fieldset" data-bind="visible: !isAddressDetailsVisible()">

is important to retain the functionality.

6
  • Thanks its working, Also i hided with css. Commented Jul 30, 2018 at 9:13
  • I want to remove customer group condition, If customer group is Retail then it should not be visible on checkout page. How i can implement this?
    – Ashna
    Commented Sep 14, 2018 at 8:27
  • You should programatically create a condition if the group is "x" hide it.
    – Raül
    Commented Sep 14, 2018 at 8:58
  • @Raül, can we uncheck the checkbox based on the shipping method selection? Commented May 30, 2019 at 12:07
  • magento.stackexchange.com/questions/310890/… Can you answer this question @Raül
    – Yousaf
    Commented Apr 21, 2020 at 5:47

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.