How to Add New Region For a Specific Country Magento 2?

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:

INSERT INTO ‘directory_country_region’ (‘country_id’, ‘code’, ‘default_name’, ‘state_code’) VALUES ('country id', 'region code', 'region name’, 'state code’);

Example 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

custom state

Example 2:

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

indian state

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!

Previous Article

How to Programmatically Delete Directory in Magento 2?

Next Article

9 Reasons For Investing In eCommerce Mobile App Development

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨