In today’s Magento 2 tutorial blog, I will justify How to Add New Region for Specific Country in Magento 2.
When a customer creates an account for your Magento 2 store, it is necessary to enter the address so that in the future while placing an order, the customer can use the saved address. Also while tax implementation, the admin requires the customer’s region and pin code to apply special rules. Magento 2 maintains the database to allow customers to select their country, state, and region.
If any region is missing or if a new region is added, at that time the developer needs to add a new region of the country in the database. Integrate Magento 2 City and Region Manager Module to add custom shipping regions and show in the store frontend.
For now, let’s look at the method to Add New Region For Specific Country in Magento 2.
How to Add New Region For Specific Country in Magento 2:
You need to run the below SQL Query:
Syntax:
1 |
INSERT INTO ‘directory_country_region’ (‘country_id’, ‘code’, ‘default_name’, ‘state_code’) VALUES ('country id', 'region code', 'region name’, 'state code’); |
Example 1:
1 |
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`, `state_code`) VALUES ('US', 'CS', 'Custom State', '45'); |
Executing the above SQL query will give you the below results
Example 2:
1 |
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`, `state_code`) VALUES ('IN', 'IS', 'Indian State', '46'); |
Executing the above SQL query will give you the below results
Wrap Up:
This way you can easily Add New Region For Specific Country in Magento 2. Dropdown your queries in the comment box. Share the article further and stay connected for more.
Happy Reading!