magento 2: how to display region name in dropdown
-
08-03-2021 - |
Question
Hi to all I added Italian region name in magento db by SQL in directory_country_region as follows:
INSERT INTO directory_country_region(country_id, code, default_name) VALUES ('IT', 'TO', 'Torino');
INSERT INTO directory_country_region(country_id, code, default_name) VALUES ('IT', 'VC', 'Vercelli');
INSERT INTO directory_country_region(country_id, code, default_name) VALUES ('IT', 'NO', 'Novara'); [...]
I also handled directory_country_region_name like this:
INSERT INTO directory_country_region_name (locale, region_id, name)
SELECT 'it_IT', dcr.region_id, dcr.code
FROM directory_country_region dcr
WHERE dcr.country_id = 'IT';
INSERT INTO directory_country_region_name (locale, region_id, name)
SELECT 'en_US', dcr.region_id, dcr.code
FROM directory_country_region dcr
WHERE dcr.country_id = 'IT';
clicking on the dropdown I'm not able to see the region name and I get this result:
I'd like to see 'Agrigento' instead of 'AG' (e.g.)
Any idea of what I'm missing? Thanks to all
Solution
I fixed the issue by myself. I replaced the second Sql code as here below:
INSERT INTO directory_country_region_name (locale, region_id, name)
SELECT 'it_IT', dcr.region_id, dcr.default_name
FROM directory_country_region dcr
WHERE dcr.country_id = 'IT';
INSERT INTO directory_country_region_name (locale, region_id, name)
SELECT 'en_US', dcr.region_id, dcr.default_name
FROM directory_country_region dcr
WHERE dcr.country_id = 'IT';
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange