WooCommerce: How to rename a country name

Last updated on

For some reason, WooCommerce (as of March 2017) lists Ireland as “Republic of Ireland”, which is not actually the official name of the state and goes against the naming convention. This could lead to lost sales with Irish shoppers who are used to choosing “Ireland” from the country dropdown menu but now can’t find it because it’s listed under ‘R’ for Republic of Ireland.

There is a fix for this. Open your functions.php file in your WordPress themes folder (usually in /wp-content/themes/your_theme_name) and paste this to the bottom

function rename_ireland( $countries ) {
	$countries['IE'] = 'Ireland';
	return $countries;
}
add_filter( 'woocommerce_countries', 'rename_ireland' );

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

Leave a reply

Your email address will not be published.