Fixed: Postcode validation does not work in Admin Create Order screen

Edition: Magento Community

Recently I hit upon a problem where, in the Admin Create Order screen (Admin > Sales > Orders > Create New Order), I selected a postcode-optional country and left the postcode field blank, but Magento was still validating the field and spitting out an error message:

Billing Address: "Zip/Postal Code" is a required value.
Shipping Address: "Zip/Postal Code" is a required value.

So why was Magento trying to validate a field that it shouldn’t?

After much digging, it turned out that the postcode attribute of the customer_address entity was missing the data_model Mage_Customer_Model_Attribute_Data_Postcode, which is what checks the config and tells Magento to validate the postcode or not.

Fixing it then was rather simple – just add the class group name ‘customer/attribute_data_postcode’ to the data_model field in the customer_eav_attribute table of the database.

Leave a Reply

Your email address will not be published. Required fields are marked *