0
0
Read Time:25 Second
add_filter( 'woocommerce_states', 'custom_us_states', 10, 1 );
function custom_us_states( $states ) {
$non_allowed_us_states = array( 'CL-AI', 'CL-AN', 'CL-AP', 'CL-AR', 'CL-AT', 'CL-BI', 'CL-CO', 'CL-LI', 'CL-LL', 'CL-LR', 'CL-MA', 'CL-ML', 'CL-NB', 'CL-TA', 'CL-VS');
// Loop through your non allowed us states and remove them
foreach( $non_allowed_us_states as $state_code ) {
if( isset($states['CL'][$state_code]) )
unset( $states['CL'][$state_code] );
}
return $states;
}