Magento by default has states only for few selected countries and you might want to include your country’s states in your site for various purpose, to give a select option in state on checkout page, to configure some rules etc.
There is no direct UI available as of now but otherwise also it is quite simple to upload this information using a CSV file and phpmyadmin. you need two to create two csv files
Step 1: directory_country_region.csv => this should include four colums region_id, country_id(in ISO-2), region code, region name.
region_id is nothing but auto incrmented id directory_country_region table, so fill this column with incremented numbers(greater then current auto_increment number)
country_id > ISO-2 code, ex. US, UK, IN
region_code => You can fill iso-2 codes for states(find it using google)
region_name => default name for the state
Step 2: directory_country_regions_name.csv => this should include 3 columns locale, region_id and region_name
locale => ex. en_us etc.
take region_id from previous file and change the default name to the locale.
It is not compulsory to fill this table, you can skip it, unless you want to support multiple locale.
I have created sample files for Indian states, directory_country_region_IN.csv and directory_country_regions_name_IN.csv
Import above csv files using phpmyadmin:-
- Select mgn_direcotry_country_region table
- Go to import
- Select CSV option in the dropdown under Format section
- Browse to your directory_country_region.csv file
- and Push the “GO” button
ek number. just need to update as they are not in alphabetical order and there is no chandhigadh….thank you…..
Lady's Moldova says
Hi. I have to add some more States for a Country ex. Romania
In my website I a use the Language of the site “romanian” (locale ro_RO) but in the directory_contry_regions_name appear locale only en_EN (that is English). In this website I will not use multilanguage.
Do I have to change also the: directory_coutry_regions_name ???
Jhon Velez says
Thank you so much
Thanks, Glad you liked it 🙂