Magento 2 store owners do not get the default dropdown option that contains all the states of Italy. In online stores when forms are used, asking customers to type the name of their respective state contributes to poor user experience. On the other hand, if the developers have to write code for each registration form and include dropdown list, it is a time-consuming and tedious task. To give better user experience and easing the developer’s task, importing states to display in dropdown option is the best thing to implement. I have prepared an SQL script to import Italian states in Magento.
SQL Script to the Import Italian States in Magento:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
INSERT INTO
directory_country_region ( region_id, country_id, code, default_name) VALUES (NULL, ‘IT’, ‘AG’, ‘Sicilia’),
(NULL, ‘IT’, ‘AL’, ‘Piemonte’),
(NULL, ‘IT’, ‘AN’, ‘Marche’),
(NULL, ‘IT’, ‘AO’, ‘Valle d Aosta’),
(NULL, ‘IT’, ‘AQ’, ‘Abruzzo’),
(NULL, ‘IT’, ‘AR’, ‘Toscana’),
(NULL, ‘IT’, ‘AP’, ‘Marche’),
(NULL, ‘IT’, ‘AT’, ‘Piemonte’),
(NULL, ‘IT’, ‘AV’, ‘Campania’),
(NULL, ‘IT’, ‘BA’, ‘Puglia’),
(NULL, ‘IT’, ‘BT’, ‘Punglia’),
(NULL, ‘IT’, ‘BL’, ‘Veneto’),
(NULL, ‘IT’, ‘PM’, ‘Piedmont’),
(NULL, ‘IT’, ‘SD’, ‘Sardinia’),
(NULL, ‘IT’, ‘SC’, ‘Sicily’),
(NULL, ‘IT’, ‘TT’, ‘Trentino-Alto Adige’),
(NULL, ‘IT’, ‘TC’, ‘Tuscany’),
(NULL, ‘IT’, ‘UM’, ‘Umbria’),
(NULL, ‘IT’, ‘VC’, ‘Valle d’Aosta‘),
(NULL, ‘IT‘, ‘VN‘, ‘Veneto‘);
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 = ‘IT‘
|