I would like to remove 3 Canadian Provinces from the Woocommerce Checkout page dropdown boxes, so those provinces cant be selected when ordering.
I found the answer for US States here on how to remove US states from the woocommerce checkout drop down boxes (code copied below):
add_filter( 'woocommerce_states', 'custom_us_states', 10, 1 );
function custom_us_states( $states ) {
$non_allowed_us_states = array( 'AK', 'HI', 'AA', 'AE', 'AP');
// Loop through your non allowed us states and remove them
foreach( $non_allowed_us_states as $state_code ) {
if( isset($states['US'][$state_code]) )
unset( $states['US'][$state_code] );
}
return $states;
}
I am wondering how to adjust this for Canadian Provinces?
The code for Canada is CA. The codes for the provinces I want to remove are:
- NU - Nunavut 2. NT - Northwest Territories 3. YT - Yukon Territory