Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter owyvan

    (@owyvan)

    @fernashes
    @sebaros

    I Did try the code,

    function xa_filter_woocommerce_states( $states ) { 
        unset( $states['AF'] );
        var_dump( $states ) ;
        return $states;
    };
    add_filter( 'woocommerce_states', 'xa_filter_woocommerce_states', 10, 1 );
    
    function xa_filter_woocommerce_get_country_locale( $locale ) { 
        $locale['AF']['state']['required'] = true;
        return $locale; 
    };
    add_filter( 'woocommerce_get_country_locale', 'xa_filter_woocommerce_get_country_locale', 10, 1 );
    

    But it was messy. I got a lot of random text on my checkout page. Instead I used,

    
    add_filter( 'woocommerce_states', 'xa_filter_woocommerce_states', 10, 1 );
    

    which made it possible to show State Field on all countries. Hope this helps anyone else having the same issue.

    • This reply was modified 6 years, 4 months ago by owyvan.
    • This reply was modified 6 years, 4 months ago by owyvan.
Viewing 1 replies (of 1 total)