Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Forked from woogists/wc-add-new-country.php
Last active April 7, 2018 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregoirenoyelle/0a28f8d487742998f0a771911d414b56 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/0a28f8d487742998f0a771911d414b56 to your computer and use it in GitHub Desktop.
Add a new country to countries list
<?php
add_filter( 'woocommerce_countries', 'gnwooc2_ajouter_pays' );
function gnwooc2_ajouter_pays( $countries ) {
$new_countries = array(
'NIRE' => __( 'Irlande du NORD', 'woocommerce' ),
);
return array_merge( $countries, $new_countries );
}
add_filter( 'woocommerce_continents', 'gnwooc2_ajouter_pays_continents' );
function gnwooc2_ajouter_pays_continents( $continents ) {
$continents['EU']['countries'][] = 'NIRE';
return $continents;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment