2

How to change required field of Zip/Postal code with "not required" from checkout page? i have changed the lines 106-111 in app/design/frontend/base/default/template/persistent/checkout/onepage/billing.phtml

<div class="field">
                    <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 validate-zip-international <?php// echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
                    </div>
                </div>

Also i have removed these lines from the file "app/code/core/Mage/Customer/Model/Address/Abstract.php"

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

But it did not completely changed that field to not required. Because when i place order, it shows a message

"Zip/Postal Code" is a required value.

3

You can change that in admin panel, itself.

Navigate to

Admin > System > Configuration > General > Country Option > Postal Code is Optional for the following countries

You can select the countries for Zip/Postal Code optional.

enter image description here

  • from which version can I find this version? I have 1.9.0.1 and I can't find it – gerosalesc Oct 27 '16 at 15:43
  • I've set the country in optional code. but it's not working. – Kailas Feb 2 '17 at 5:14
0

You need to make sure you are viewing the "DEFAULT" screen view, it won't show if yiou are viewing in any other store view

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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