How to Import Australian States in Magento
From the design standpoint, drop-down is an excellent feature which helps creating cleaner layout and automatically validates the input. While working with Magento 1 or Magento 2, the best example is country and state drop down lists.
Talking about Australia, majority of the older Magento 1 and Magento 2 versions don’t include states drop down list for it. Magento developers need to deal with creating a list of states while adding forms or in the backend configuration. So here, I’ve come up with the SQL script to import Australian states in Magento here!
You may use the SQL script while creating shipping rules, setting a default state for a country, allowing customers to select shipping state in Australia while placing orders, etc. Anything related to Australian states in Magento development and the script is ready for you ?
SQL Script to Import Australian States in Magento:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
INSERT INTO `directory_country_region` (`region_id`, `country_id`, `code`, `default_name`) VALUES (NULL, 'AU', 'NSW', 'New South Wales'), (NULL, 'AU', 'QLD', 'Queensland'), (NULL, 'AU', 'VIC', 'Victoria'), (NULL, 'AU', 'WA', 'Western Australia'), (NULL, 'AU', 'TAS', 'Tasmania'), (NULL, 'AU', 'SA', 'South Australia'), (NULL, 'AU', 'NT', 'Northern Territory'), (NULL, 'AU', 'ACT', 'Australian Capital Territory') ; INSERT INTO directory_country_region_name( locale, region_id, name ) SELECT 'en_US' AS "language", region_id, default_name FROM `directory_country_region` WHERE country_id = 'AU' |
The implementation is very easy, however, feel free to post your doubts in the comments section below and I’d be happy to help.
Thank you ?
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
Prev
Useful Magento 2 Indexer Commands for Developers
How to Set Dynamic Email Subject in Magento 2
Next