1

How do I disable the fax field for customers? (preferrably using the admin, not removing code)

  • From Admin it's difficult. Can do with DB? – Ankit Shah Dec 14 '16 at 9:49
  • How do you mean? Removing tables in the database? – Maarten Wolfsen Dec 14 '16 at 9:51
  • Just disable that field from Database Table – Ankit Shah Dec 14 '16 at 9:57
  • I'd rather find another way to be honest. If the webshop owner wants to enable the fax again, I don't want to mess in the database. I'd prefer a code solution more than a database solution – Maarten Wolfsen Dec 14 '16 at 10:21
  • then create a module that triggers enable/disable in database. – belfort1 Dec 14 '16 at 12:40
2

I would never recommend writing a module to hide an attribute, in most cases this can be done via the admin panel. Here is how to disable fax via the admin panel.

This is for Magento EE 2.1.1

  1. Goto Stores - Attributes - Customer Address
  2. Click on the attribute fax and set use in customer segment to no

This is for Magento CE 2.0.7

  1. Goto Stores - Configuration - Customers - Customer Configuration
  2. Expand Address Templates group and remove {{depend fax}}<br/>F: {{var fax}}{{/depend}} from all the text boxes.

I've only specified these versions because thats the ones I tested on.

  • Is this a Magento 2 solution? Because I can't find 'attributes' under 'stores' – Maarten Wolfsen Dec 14 '16 at 13:39
  • Yes, this is a Magento solution. What version of Magento are you running? – André Ferraz Dec 14 '16 at 14:16
  • I'm currently running 2.0.7. – Maarten Wolfsen Dec 14 '16 at 14:18
  • Yes you should have it, go to stores and there should be a a link called Customer Address under the label attributes – André Ferraz Dec 14 '16 at 14:19
  • See screenshot i.stack.imgur.com/Gq0BY.png – André Ferraz Dec 14 '16 at 14:20
0

Add the following code in your style.css and it will remove the Fax field only from your Checkout page in frontend.

.checkout-index-index .field[name="shippingAddress.fax"] { display: none; }

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.