I am using Magento 1.9.x version for my website.

Now I am fectching the country list for storing country in a business directory.

I am able to fetch all the states of a particular country (US) when it is selected, by ajax, but now when any state is selected, I want a list(drop-down only) of zipcodes for the selected state, to appear right below the state dropdown.


My question is how to fetch zipcodes list for a specific country and state, like web api

How can I achieve that ?

2 Answers 2


Default magento does have this feature.You need to do customization for your requirement.

  • First create a custom module which have a custom table and custom model. At table,you need to save country id,region id and zipcodes
  • Then, on change of region and country, call ajax which will given list of zip code
  • My question is how to fetch zipcodes list for a specific country and state, like web api ?
    – Vicky Dev
    Commented Jan 3, 2016 at 15:38
  • From what I can tell, Magento does not have zip codes as part of its data. You would have to find that information, store it in a custom table, then use your API to access that information. There is a listing of countries, and Cities, but not zip codes. So if you look in your database at the table directory_country_region you will see Countries, but no zip codes. Commented Jan 3, 2016 at 16:47

As Amit Bera said , there is no such feature in magento. You can achieve it by creating a custom module , with custom table where you need to save country_name , state_name , pin_code in it.

So wherever state field is coming on front-end , you need to create js onchange function for that field to update in zip-code.

But before acheiving this you need the list of states for all countries & update them in DB.

There is no web api for retrieving pin code.

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.