Magento 2 – How to Remove an Input in Billing Address Form

billing-addresscheckoutknockoutjsmagento2

I have to remove fax input from billing-address in checkout process.
( when you check out "My billing and shipping address are the same" and the form appears )

Found that is generated here :

Magento > Checkout > view > frontend > web > template > billing-address.html

<!-- ko template: 'Magento_Checkout/billing-address/form' --><!-- /ko -->

No idea where those inputs are generated, i only want to remove fax from there, allready tried to remove fax from checkout_index_index.xml layout with no luck. I dont understand how "ko" works or where i can change this.

enter image description here

Best Answer

You can remove Fax using by below code.

Add this code to in your theme checkout_index_index.xml file inside body tag.

app/design/frontend/Vendor/Theme/Magento_Checkout/layout/checkout_index_index.xml

<referenceContainer name="content">
            <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="shipping-step" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <item name="shippingAddress" xsi:type="array">
                                                        <item name="children" xsi:type="array">
                                                            <item name="shipping-address-fieldset" xsi:type="array">
                                                                <item name="children" xsi:type="array">
                                                                    <item name="fax" 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>
        </referenceContainer>

Clear cache and check.