Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

remove some state from state list woocommerce

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #state #state #list #woocommerce
ADD COMMENT
Topic
Name
5+9 =