I have fresh install Magento, I set some countries to not required to enter post code on checkout page, the "*" sign is not display in frontend for those selected countries.

But After I clicked Continue without entering post code, I still get the javascript pop up alert saying ""Zip/Postal Code" is a required value."

enter image description here

I tried to change the post code field to

<label for="billing:postcode"><?php echo $this->__('Zip/Postal Code') ?></label>
<div class="input-box">
    <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text" />

But I still get pop up alert.

How to fix this?

2 Answers 2


Next try, with the correct error message. This error comes from here:

if ($attribute->getIsRequired() && empty($value)) {
    $errors[] = Mage::helper('eav')->__('"%s" is a required value.', $label);

And the part $attribute->getIsRequired() is true, if the column is_required in eav_attribute = 1.

To change this, you should write an data update script and change the attribute. A description can be found here: https://stackoverflow.com/questions/10420199/magento-module-setup-change-product-attribute-to-not-required


Wrong part

This is no magento standard behaviour.

If your input doesn't containt class="required", there is no JS-error raised. So whatever theme you use, check this.

The error is raised here:

$_havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
if (!in_array($this->getCountryId(), $_havingOptionalZip)
    && !Zend_Validate::is($this->getPostcode(), 'NotEmpty')
) {
    $errors[] = Mage::helper('customer')->__('Please enter the zip/postal code.');
  • Actually, it uses default theme, and it is fresh install and only one extension installed there. I will check if the extension makes this problem.
    – Wakanina
    Mar 12, 2014 at 14:56
  • Are you sure it is a JS error? Ah damn it. This is no JS error, this error is thrown thorugh the AJAX request. I'll update the answer Mar 12, 2014 at 15:14
  • Thanks Fabian for your help. I have commented above code in your answer, but still not works. I also check Mage::helper('directory')->getCountriesWithOptionalZip();, and the countries are exist, even my selected country in checkout page is exist. The error is not Please enter the zip/postal code. but "Zip/Postal Code" is a required value.. I edited my question, screenshot added. I think many people have the same problem. I searched on Google, but still not find the solution or the cause of this problem.
    – Wakanina
    Mar 13, 2014 at 6:10
  • 1
    Please check if eav_attribute -> postcode is_required = 1 updated the answer. Mar 13, 2014 at 6:13
  • Oh yeah... Thanks Fabian, this solved the problem, I changed it to 0 directly from DB. Can I change it from backend? Is there any configuration in backend to do this? I didn't found it in backend.
    – Wakanina
    Mar 13, 2014 at 6:29

I think this article may be helpful for you: http://www.magebuzz.com/blog/fixed-optional-postal-code-working/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.