I want to add new state in WooCommerce. I used woo-state and snippet plugin and added this code:
function woo_add_my_country( $country ) {
$country["AE-DU"] = 'Dubai';
return $country;
}
add_filter( 'woocommerce_countries', 'woo_add_my_country', 10, 1 );
But still I cannot see it.
How to add new state for a country to WooCommerce?
2
Answers
You are not using the right hook and way to do it. Use the following instead:
And you can add a placeholder to the select field for ‘AE’ country code like (optional):
Code goes in functions.php file of your active child theme (or active theme). Tested and works.
All Related questions and answers using
woocommerce_states
hook.This is how you can add more states to existing list of states for any country.