Referring to the 'Estimate Shipping and Tax' section on Shopping Cart page - Magento EE, by default the 'Country', 'State/Province' and 'Zip/Postal Code' are not required.

enter image description here

This block is in the following template frontend\enterprise\default\template\checkout/cart/shipping.phtml

As in the code snippet below, the 'required' (CSS) class is added only if $this->isZipCodeRequired() is set to true.

    <label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>>
<?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?>
<?php echo $this->__('Zip/Postal Code') ?></label>

My question is: where is Magento checking for these values and can they be set in Magento Admin?

Note that the field "Postal Code is Optional for the following countries" in Magento Admin may not be an answer for this as, the above code snippet doesn't depend on the country.

2 Answers 2


If you want to make it required no matter what, just hard-code it in the template. It should be on the input, not just the label.

<label for="postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
   <div class="input-box">
      <input class="input-text validate-postcode required-entry" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
  • I don't want to hard-code it in the template. My question is: where is Magento checking for these values and can they be set in Magento Admin? In other words, how is this method returning a true or false? $this->isZipCodeRequired() Jul 23, 2013 at 18:08
  • Ah. Stepping backwards, 'function isZipCodeRequired' is in core/Mage/Checkout/BlockCart/Shipping.php. It goes through each carrier to find out if the zip code is required for that EstimateCountryId. From there, there's two functions. code/core/Mage/Shipping/Model/Carrier/Abstract.php has the same function, but it only returns false. The other is in code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php, which checks to see if ZipCodeOptional (return !Mage::helper('directory')->isZipCodeOptional($countryId);)
    – aynber
    Jul 23, 2013 at 18:27
  • isZipCodeOptional is found in code/core/Mage/Directory/Helper/Data.php, which checks to see if the countrycode is in CountriesWithOptionalZip. Which pulls from the Magento admin. ($this->_optionalZipCountries = preg_split('/\,/', Mage::getStoreConfig(self::OPTIONAL_ZIP_COUNTRIES_CONFIG_PATH), 0, PREG_SPLIT_NO_EMPTY); )
    – aynber
    Jul 23, 2013 at 18:29

Log in to the admin and navigate to "System >> Configuration", under the General heading click "General". All the options are there.

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.