cancel
Showing results for 
Search instead for 
Did you mean: 

Zip Code validation on zip_codes.xml file

SOLVED

Zip Code validation on zip_codes.xml file

Hello,

 

I would like to limit the zip codes and tweak the zip_codes.xml file in Magento.

so the file says:

 

<code id="pattern_1" active="true" example="1234">^[0-9]{4}$</code>
<code id="pattern_2" active="true" example="1234-567">^[0-9]{4}-[0-9]{3}$</code>

 

But I wanted to see if there is a way not allow any value more than 1999 or 1999-999 to be entered.

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Zip Code validation on zip_codes.xml file

2 REPLIES 2

Re: Zip Code validation on zip_codes.xml file

@sahandsigm749e 

 

What challenges are you facing in this, this is correct. It should work as expected.

Here is official document:

https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_zip.html

https://github.com/magento/magento2/blob/2.3/app/code/Magento/Directory/etc/zip_codes.xsd

 

How to override:

https://magento.stackexchange.com/questions/223451/how-to-override-magento-directory-module-etc-xml-... 

Manish Mittal
https://www.manishmittal.com/

Re: Zip Code validation on zip_codes.xml file