Home / functions.php / Add new country to WooCommerce countries list
  • How to Add new country to WooCommerce countries list

    rename-a-country-in-woocommerce

    This is a simple snippet from the wonderful people at WooCommerce and does exactly what you would think. Add this snippet to the functions.php to add a new country to WooCommerce countries list.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    function woo_add_my_country( $country ) {
       $country["AE-DU"] = 'Dubai';
       return $country;
    }
    add_filter( 'woocommerce_countries', 'woo_add_my_country', 10, 1 );
    

    ( WordPress codex functions, hooks, in this snippet. )

    add_filter,