Page 1 of 1

Hiding Telephone in Checkout Personal Details

Posted: Fri Nov 17, 2017 7:01 pm
by mrblond
How to hide/remove the telephone field in Checkout>Billing Details>Your Personal Details?

Re: Hiding Telephone in Checkout Personal Details

Posted: Fri Nov 17, 2017 8:36 pm
by straightlight
This extension may provide what you need: https://www.opencart.com/index.php?rout ... n_id=21931 . However, it may require small adjustments for v3.x releases.

Re: Hiding Telephone in Checkout Personal Details

Posted: Sat Nov 18, 2017 2:39 pm
by avarahvahin
You can do it manually using below steps:
1. from theme template file, catalog/view/theme/yourtheme/template/checkout/register.twig, hide/remove telephone field.
2. From controller file, catalog/controller/checkout/register.php, remove line $json['error']['telephone'] = $this->language->get('error_telephone');
You can use the extension to remove telephone field validation, https://www.opencart.com/index.php?rout ... n_id=32474

Re: Hiding Telephone in Checkout Personal Details

Posted: Sun Jun 18, 2023 9:25 am
by FoxT337
Hey. Thanks for this 'hard coding' answer.
Just to add my own 2¢ it did work in oc 3.0.3.7 [not using the latest]
and removing the same lines from guest.php and guest.twig will also allow checkout for guests to not enter their #.
NOTE: I did not remove the lines however, I only commented them out in case I needed to revert.

EDIT: In order for this telephone hack to work you will also need to look for all the files that use the 'telephone' var and erase or comment out the needed lines.
PLUS ALSO: If wanted, one can just edit out the * [asterisk] before the telephone field and then find the correct lines in the correct file that cause an error if the field is empty. This way you can get the number but don't have to.