3

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.

0

To remove fields in the checkout you can use this in checkout_index_index.xml, it doesn't matter if it was required or not, gone is gone:

<item name="telephone" xsi:type="array">
      <item name="config" xsi:type="array">                                                             
          <item name="componentDisabled" xsi:type="boolean">true</item>
     </item>
</item>

checkout_index_index.xml should be added to

public_html/app/design/frontend/%Vendor%/%Themename%/Magento_Checkout/layout

You can read more about this here.

|improve this answer|||||
0

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>
|improve this answer|||||

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.