如何在 magento 2 的结帐页面中将 "State/Province" 字段从文本更改为下拉列表
How to change "State/Province" field from text to dropdown list in checkout page in magento 2
我正在寻找一种解决方案,我可以在其中更改 "State/Province" 字段以在我的网站结帐页面的发货部分显示为下拉列表。商店的默认国家/地区设置为 AU(澳大利亚)。虽然我在 table "directory_country_region".
中添加了目标国家 (AU) 的状态
我在 的 状态选项 中设置了国家 "Australia",在商店 > 配置 > 常规中。
但是即使清除缓存后也没有任何变化出现。我在这个问题上苦苦挣扎了好几个小时。任何修复它的帮助都会很棒。
运行 下面 SQL 在 Magento 2 中添加澳大利亚州下拉列表的查询:
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'ACT', 'Australian Capital Territory');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'NSW', 'New South Wales');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'VIC', 'Victoria');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'QLD', 'Queensland');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'SA', 'South Australia');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'WA', 'Western Australia');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'TAS', 'Tasmania');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'NT', 'Northern 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';
一旦上述 SQL 脚本 运行 正确,澳大利亚州下拉列表将显示,同时选择澳大利亚作为国家/地区。您可以在任何地方使用此 SQL 脚本在 Magento 2 中添加澳大利亚州下拉列表。
我正在寻找一种解决方案,我可以在其中更改 "State/Province" 字段以在我的网站结帐页面的发货部分显示为下拉列表。商店的默认国家/地区设置为 AU(澳大利亚)。虽然我在 table "directory_country_region".
中添加了目标国家 (AU) 的状态我在 的 状态选项 中设置了国家 "Australia",在商店 > 配置 > 常规中。 但是即使清除缓存后也没有任何变化出现。我在这个问题上苦苦挣扎了好几个小时。任何修复它的帮助都会很棒。
运行 下面 SQL 在 Magento 2 中添加澳大利亚州下拉列表的查询:
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'ACT', 'Australian Capital Territory');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'NSW', 'New South Wales');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'VIC', 'Victoria');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'QLD', 'Queensland');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'SA', 'South Australia');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'WA', 'Western Australia');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'TAS', 'Tasmania');
INSERT INTO `directory_country_region` (`country_id`, `code`, `default_name`) VALUES ('AU', 'NT', 'Northern 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';
一旦上述 SQL 脚本 运行 正确,澳大利亚州下拉列表将显示,同时选择澳大利亚作为国家/地区。您可以在任何地方使用此 SQL 脚本在 Magento 2 中添加澳大利亚州下拉列表。