7

I am trying to make a zip code and postal code mandatory for shipping and billing information but i am not success kindly provide some solutions.

2
  • Default magento billing.phtml file already contains validation class validate-zip-international this is not working for you?
    – Mufaddal
    May 9, 2014 at 5:17
  • The magento default theme already supports this.
    – Sukeshini
    May 9, 2014 at 5:21

3 Answers 3

15

Go to

System->Configuration->Default->General->Countries Options

Multiselect Box called ‘Postal Code is Optional for the following countries’.

Select the countries you want the field as optional.

As far as concerned with code changes, It is always recommended to follow inbuilt features instead of code changes.

1
  • 1
    OP don't want to make field as optional
    – Mufaddal
    May 9, 2014 at 9:46
1

their will be a text box for the zip code their please add "required-entry" in the class attribute of the zipcode textbox.then it is done

for eg.

<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="required-entry input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />

see i had added required-entry in class above

1
  • How can i get checkout page shipping zip code?
    – Gem
    Oct 3, 2018 at 9:23
1

The other way is to add required-entry class name to the fields by visiting the templates.

1
  • I think it's required-entry.
    – Marius
    May 9, 2014 at 7:12

Your Answer

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

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