2

I would like to remove postcode and company from the billing address showing in second step [#payment] of checkout page.

copied checkout_index_index.xml file from vendor and placed in theme folder checkout_index_index.xml is as follows:

<referenceBlock name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="steps" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="billing-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="payment" xsi:type="array">
                                                <item name="component" xsi:type="string">Magento_Checkout/js/view/payment</item>
                                                <item name="children" xsi:type="array">
                                                    <item name="billing-address-fieldset" xsi:type="array">
                                                        <item name="children" xsi:type="array">                                                            
                                                            <item name="postcode" xsi:type="array">                                                             
                                                                <item name="visible"                                                                xsi:type="boolean">false</item>
                                                            </item>
                                                            <item name="company" xsi:type="array">
                                                                <item name="visible"                                                                xsi:type="boolean">false</item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</body>

When removed pub/static/frontend/ var/cache, var/page_cache, var/view_preprocessed and run below CLI commands.

php bin/magento s:s:d -f
php bin/magento c:f

i do not see changes to Billing Address fields. I'm not sure what I'm missing.

Thanks in advance.

  • ok +1 because I didn't know i could abbreviate commands O.O – jamil Mar 23 '18 at 20:25
3

You can remove Company from the Magento dashboard. Go to

Stores > Configuration > Customers > Customer Configuration > Name and Address Options

But if you want to remove them from the layout file just put:

<item name="company" xsi:type="array">
    <item name="visible" xsi:type="boolean">false</item>
</item>
<item name="postcode" xsi:type="array">
    <item name="visible" xsi:type="boolean">false</item>
</item>
  • @Adrizan i had removed the city by using your code.. but it shows the error as city is required on shipping address in payment method selection step. please help me solve this error. – Ask Bytes Dec 1 '18 at 7:04

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.