Removing Telephone Required Validation on Addresses in Magento

Home / Blog / Removing Telephone Required Validation on Addresses in Magento

The telephone field on the Magento address is a required field. You’d think that removing this constraint would be as easy as removing the required-entry class so that the client-side javascript validation doesn’t require it, but its not that simple.

Removing the telephone as a required field on any Magento customer address requires 3 changes:

1. As noted above, remove the ‘required-entry’ class from the telephone HTML input

2. Go to your admin panel, and navigate to “Customers->Attributes->Manage Customer Address Attributes” and select the ‘telephone’ attribute. Update the “Values Required” selection to “No”.

3. Since Magento has server-side validation on this field as well, you’ll need to override the Mage_Customer_Model_Address class. Just as you would do any override, create a local module or copy this file into your local folder directory. The only method you need to override is the validate() buy yasmin online method. It should look like this (Magento 1.4/Enterprise 1.9):

public function validate()
		$errors = array();
		$helper = Mage::helper('customer');
		if (!Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the first name.');

		if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the last name.');

		if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the street.');

		if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the city.');

		//		if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
		//			$errors[] = $helper->__('Please enter the telephone number.');
		//		}

		$_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
		if (!in_array($this->getCountryId(), $_havingOptionalZip) && !Zend_Validate::is($this->getPostcode(), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the zip/postal code.');

		if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the country.');

		if ($this->getCountryModel()->getRegionCollection()->getSize()
		&& !Zend_Validate::is($this->getRegionId(), 'NotEmpty')) {
			$errors[] = $helper->__('Please enter the state/province.');

		if (empty($errors) || $this->getShouldIgnoreValidation()) {
			return true;
		return $errors;

With these three pieces in place, you’ll now be able to remove the telephone from the form (or just make it optional) without Magento throwing a fit.

Let me know if anyone would like additional clarification on this…

Showing 6 comments
  • Hans Smits


    I use Magento 1.4 for the first time, but cannot find the back-end value you talk about:

    “Customers->Attributes->Manage Customer Address Attributes” and select the ‘telephone’ attribute. Update the “Values Required” selection to “No”.

    I havo no ‘Attributes’ in the customers dropdown ..

    Grtz Hans

  • tmillhouse

    Hmm … I just compared 1.4 to Enterprise 1.9, and it looks like that menu option is only available in Enterprize 1.9. Instead of updating the “required” level through the admin panel, you’ll have to update it directly in the database. Since Magento uses an EAV data model, you should be able to identify this attribute by filtering based on the address type.

    Let me know if you have questions on how to do this, and I’ll take a look later. Also, I’ll update this article to reflect your findings.

  • Reinoud

    Should the above also remove the validation from the My Account Dashboard? In my case using Magento it doesn’t!

  • tmillhouse

    I can’t remember exactly (its been a while since I worked on this), but the account dashboard uses a different Address object (from what I can remember). So,in step 3 above, I instructed to override and remove the phone field validation from Mage_Customer_Model_Address. Well, on the account side, there is another Address wrapper object that also contains the phone validation. You’ll want to do the same to that class as well (override and remove the validation).

    I hope that puts you on the right track. If you still can’t find it, I’ll sift through my old emails and see exactly what the fix was for that.


  • Basement Flooring

    I have the opposite problem. I need to make the telephone a required field on Magento v. I can’t find in the back end anywhere to make it required field. We ship via LTL heavy products such as basement flooring and garage flooring which makes it required for trucking delivery. Magento is nice but some basic things like these are overlooked. Does any one have any suggestions on how to do this?

  • tmillhouse

    Hmm … I’m not sure of your version specifically, but from what I remember, the telephone can be set as a required/not-required attribute via the admin panel at Catalog->Attributes->Manage Attributes. Search for the telephone attribute and you can update it there. Let me know if this doesn’t work, and I can take a deeper look.

    Also, my apologies for the late reply; I’m just getting back from vacation and getting caught up on email …

Leave a Comment