Magento – How to remove required and non-required fields in checkout for Magento 2

checkoutmagento2

I need to remove some fields in Magento 2 in the checkout, for example fax and other. At the same time, i need to remove also some required fields, for example e-mail. In my place some old people do not use e-mail, therefore when they place an order they type thier phone, so the manager call to customer to now details of order. So, in my situation, i need to make required only this field in checkout:

  • Telephone

And i need to shows only following fields as non-required:
– Name, Surname
– E-mail
– City

So, totaly 4 fields must be shown to customer, and the others (fax, address, etc.) must be hidden (or better disabled).
I'm only begginer in Magento, so kindly ask you to give me some guide how can i do this and explain in details. Also, please, say to me all the path to file that i need to edit. I have some knowledge of PHP, for some CMS before i write modules, but a cannot understand which file to edit to hide and disable required fields in case of Magento 2. Thx.

Best Answer

Add this code in the checkout_index_index.xml for remove the require entry at the respective item name. For example, i have removed required for firstname.

<item name="firstname" xsi:type="array">
    <item name="validation" xsi:type="array">
        <item name="required-entry" xsi:type="boolean">false</item>
    </item>
</item>
Related Topic