Add New Country to WooCommerce Countries List

By default, WooCommerce has a list of countries that can be used for storing customer's shipping and billing information. The list includes most of the country in the World. However, just in case if you can't find your country on that list, you can easily add your country on the list. Here is the snippet.
/* Add a country to countries list */
add_filter('woocommerce_countries','add_country_to_the_list', 10, 1);
function add_country_to_the_list($country) {
   $country["US"] = 'United States';  
   return $country;
All you gotta do now is to copy and paste the snippet mentioned above on your theme's functions.php page and update it. Now go back to your profile page and check out for the name you just added. Using this snippet, you can add pretty much as many country as you want. A comprehensive list of all the countries with their ISO 3166-1 Alpha 2 country code can be found from here. Before you add any country though, simply make sure that you don't have the country already listed from WooCommerce. References: add_filter, woocommerce_countries


Commenting is disabled.