Magento
Now Reading
How To Add States or Provinces in Magento For India
0

How To Add States or Provinces in Magento For India

by UmarSeptember 20, 2013

The states or provinces of India are not present by default in Magento 1.7 or older versions. If you want to include the states or territories in the checkout process or during registration, you will need to do it manually using SQL (phpMyAdmin). It’s an easy task taking less than a second to complete.

add_indian_states_in_magento

Note: Before continuing backup the database first, in case anything untoward happens, we can easily revert back.

So here are the steps to include States or Provinces of India Inside Magento 1.7 or below:

1. Login to the Cpanel and go to phpMyAdmin

2. Select the database in which your magento installation is running.

3. Go to SQL.

4. Now here you will need to run the following code:

INSERT INTO `directory_country_region` VALUES
(NULL , "IN", "Andaman Nicobar","Andaman Nicobar"),
(NULL , "IN", "Andhra Pradesh","Andhra Pradesh"),
(NULL , "IN", "Arunachal Pradesh","Arunachal Pradesh"),
(NULL , "IN", "Assam","Assam"),
(NULL , "IN", "Bihar","Bihar"),
(NULL , "IN", "Chandigarh","Chandigarh"),
(NULL , "IN", "Chhattisgarh","Chhattisgarh"),
(NULL , "IN", "Dadra Nagar Haveli","Dadra Nagar Haveli"),
(NULL , "IN", "Daman Diu","Daman Diu"),
(NULL , "IN", "Delhi","Delhi"),
(NULL , "IN", "Goa","Goa"),
(NULL , "IN", "Gujarat","Gujarat"),
(NULL , "IN", "Haryana","Haryana"),
(NULL , "IN", "Himachal Pradesh","Himachal Pradesh"),
(NULL , "IN", "Jammu Kashmir","Jammu Kashmir"),
(NULL , "IN", "Jharkhand","Jharkhand"),
(NULL , "IN", "Karnataka","Karnataka"),
(NULL , "IN", "Kerala","Kerala"),
(NULL , "IN", "Lakshadweep","Lakshadweep"),
(NULL , "IN", "Madhya Pradesh","Madhya Pradesh"),
(NULL , "IN", "Maharashtra","Maharashtra"),
(NULL , "IN", "Manipur","Manipur"),
(NULL , "IN", "Meghalaya","Meghalaya"),
(NULL , "IN", "Mizoram","Mizoram"),
(NULL , "IN", "Nagaland","Nagaland"),
(NULL , "IN", "Orissa","Orissa"),
(NULL , "IN", "Pondicherry","Pondicherry"),
(NULL , "IN", "Punjab","Punjab"),
(NULL , "IN", "Rajasthan","Rajasthan"),
(NULL , "IN", "Sikkim","Sikkim"),
(NULL , "IN", "Tamil Nadu","Tamil Nadu"),
(NULL , "IN", "Tripura","Tripura"),
(NULL , "IN", "Uttar Pradesh","Uttar Pradesh"),
(NULL , "IN", "Uttarakhand","Uttarakhand"),
(NULL , "IN", "West Bengal","West Bengal");
 
INSERT INTO `directory_country_region_name` (`locale` ,`region_id` ,`name` ) 
    SELECT 'en_US', tmp.region_id, tmp.default_name FROM `directory_country_region` 
        AS tmp WHERE tmp.country_id='IN';

add_indian_states_in_magento2

The above SQL code will add States of India in directory_country_region and directory_country_region_name tables.

That completes the task. Now you have States of India inside the Magento database. Users can now select the State from which he/she belongs using the drop down list.

What's your reaction?
Love It
0%
Interested
0%
WTF
0%
Wink
0%
Sad
0%
Angry
0%
Whatever
0%
Me No Like
0%
About The Author
Umar
Umar
Umar is a technological freak. He is very much into gadgets and games. Blogging is his hobby.

Leave a Comment