Magento – Magento 2.2.2 – how to remove company and zipcode from billing address from checkout

billing-addresscheckoutcheckout-pagemagento2.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.

Best Answer

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>
Related Topic