magento2: Telephone number on customer address shouldn't be required

Hi guys

Why is the telephone number still required on a customer address? We hear from our shop owners that a lot of customers refuse to enter something in there or just enter gibberish.

An ideal solution would be if you could add a configuration option in the backend similar to the Gender, Tax/Vat Number and Date of Birth fields. So an option for showing the telephone number where you can choose between No, Optional or Required. What do you think?

I had to implement this today into a Magento CE 1.x store and it was kind of a terrible experience, changing stuff in the database, remove the hard coded validation of that field (which is still present btw: https://github.com/magento/magento2/blob/93312cae42824274722fe7a285d5ce8e40f177a1/app/code/Magento/Customer/Model/Address/AbstractAddress.php#L572), …

Related to https://github.com/magento/magento2/issues/624

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 3
  • Comments: 49 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I have created a module which removes the requirement on the telephone input: https://github.com/zsoerenm/magento2-optionaltelephone It can be installed via composer

ok - i give it up. if it takes more then one year to implement a highly needed function like making the telephone number not a required field i am out of this topic.

For me it feels like “bugs” and functions are discussed here over and over again but nothing happens. I do not like to know how many people from magento side and developers have spent time in reading this and finding a solution. For the magento core team it should only be a view hours to implement this - but instead we are discussing more then a year and there is no easy way or solution on this.

Sry guys - but a shop system where you can not make the telephone field a not required field without a massive effort is a no go for me and my team.

In some countries a telephone number is not required for shipping, but it drops the conversion rate. It is absolutely essential to disable the telephone number by need.

I can send fix for $70 🥇 💃

there are several design decisions in m2 that are flat out weird if not horrible, on the other hand, when was m1 fully stable? when was the feature set mature enough for most peoples needs? magento strives to be the swissarmy knife of shops so it has a wide configurable functionality. I think the main issue here is a lack of communication and that magento is developed behind closed doors (no public roadmap or ticket system).

Hi,

When a store sells only virtual products, the telephone is not required as there is no delivery. So I think it is a good idea to make this field optional.

I’ve stopped long time ago. Not worth to put any effort into Magento2.

Discussing ETA with the development team.

@ilol the first is really important to have an option here in the backend to 1. show the telephone number yes/no and 2. to have it as a required field yes/no - so anyone can decide.

I think it is a must must have (look at hundreds of posts in forums regarding this on magento1 and 2 now. 😕. The hole checkout is in my view very very hard to customize and takes ages to load especially on mobile devices. Also usability is not really well designed - but this is another topic.

Yes exactly. The telephone number should be optional. Here in Germany there is no need for this at all. Can someone point out how we make this field not a required field or how we can even delete it?

I don’t think so, phone number is required by default because it is the basic e-commerce or commerce workflow. How do the seller contact to buyer without any phone number? This is also an avoid-abuse system, of course if the man who placed an order without any phone number, it is obviously abuse order and should be ignored.

Its a shame that you actually offer a DB-Column to turn this off but still validate the field hardcoded and that too at different places “DRY” “SOLID” plus your developers actually use interfaces and classes for the same instance in constructor DI eg. Magento\Customer\Api\AddressRepositoryInterface and Magento\Customer\Model\ResourceModel\AddressRepository

you guys really should try to make our lives easier with M2 and not worse than M1

just a rough overview: in di.xml we addressed:

  • <preference for="Magento\Sales\Model\Order\Address\Validator" type="Your\Module\Model\Order\Address\Validator" />
  • <preference for="Magento\Customer\Model\Address" type="Your\Module\Model\Address" />
  • <preference for="Magento\Quote\Model\Quote\Address" type="Your\Module\Model\Quote\Address" />
  • <preference for="Magento\Customer\Model\ResourceModel\AddressRepository" type="Your\Module\Model\ResourceModel\AddressRepository" />

in each instance we extended the original class and replaced the following methods:

  • \Magento\Sales\Model\Order\Address\Validator::validateForCustomer
  • \Magento\Quote\Model\Quote\Address::validate
  • \Magento\Customer\Model\ResourceModel\AddressRepository::_validate the method is private so you will have to implement a copy of this method and replace the save method instead, using your own _validateX method
  • \Magento\Customer\Model\Address::validate

database:

in the database we changed the telephone attribute required flag and removed the validation (not sure if the last part is necessary, maybe if someone enters a value you still want it validated)

my general observation implementing this using various approaches was, that the system is very cluttered in terms of where information is coming from, you got the attribute in the database, you got the layout.xml defining the javascript thats being rendered, you got the configprovider files where some properties are coming from as well and then you have the validators in several places. I feel like there should be single central point which defines what needs to be validated and how.

I would have to disagree that someone placing an order without a phone number is obviously a fraudulent order and that there’s no other way to contact a customer but by phone. A clear example would be in the industry that we’re in which is adult products and where discretion is valued very highly. Not everyone wants to provide a phone number because they don’t want to run the risk of getting called on their personal line about an intimate product.

Second, the most obvious way to contact a customer if they don’t provide a phone number is via email; which almost all of our customers prefer. A good portion of phone numbers we are provided are obvious fake phone numbers; but we hardly receive fake email addresses. I can only imagine how many abandoned carts we’re receiving due to the required phone number field and the sensitivity to providing that information in our industry.

I solved the problem with the following steps:

  1. Using sql query update eav_attribute set is_required=0 where attribute_code='telephone';
  2. Modified Magento\Sales\Model\Order\Address\Validator::validateForCustomer()
  3. Modified Magento\Customer\Model\ResourceModel\AddressRepository::_validate()
  4. Modified Magento\Customer\Model\Address\AbstractAddress::validate()

I think this approach is a true evidence of incapacity for magento: The phone number is a hard-coded mandatory field, after a year of discussion nothing happened with this field and last but not least, i can not understand why there are are so much changes in a DRY, high flexibility codebase are needed. Sorry, but i will disadvise my customers to use magento for a shop system.

@nntoan this is not how it works everywhere and in all industries. No one says remove that field, we are just asking to get an option to make it optional. This way anyone can decide whether orders without phone numbers can be accepted or not.

ok no information - expected nothing else. no timeline no info… 👎

i want to add mobile sms otp in cash on delivery payment method in magento 2 i know otp code but i dont know how to get telephone number. or where to get telephone session telephone

Thanks and Regards

@ilol

If there is no chance to make this as an option in a magento release it would be great to have a documentation explaining how to delete tel. number or make it not a required field. Many people asked for this and i can not find any official documentation here. Can you pls provide this for the moment for us?

I agree on this. Phone numbers are not always necessary in specific situations and / or countries. It is like state information and postal codes, some kind of configuration to make this mandatory would be really helpful.

Because vast majority of parcel services require it and for good reason

@pronto2000 I’m not sure if there is a country for which this statement is true and if you are living in it but for most parts of the world this is bullshit (one of my clients ships worldwide and works with nearly all international and some national parcel services and none ever required a phone number).

I also think it’s now illegal in Germany to force people to enter their phone number at the checkout

And yes, in Germany you can even get sued for it if you are selling products where it is not absolutely essential to get the phone number to fulfill the order. So basically 99% of German shops would face the risk of a pricy written warning with Magento this way.

Please give this some priority!