Tax Exclude from Certain States USA WooCommerce

Tax Exclude from Certain States USA WooCommerce
add_action( 'woocommerce_checkout_update_order_review', 'isktaxexempt_checkout_based_on_state', 10, 1 );
  
function isktaxexempt_checkout_based_on_state( $post_data ) {
        WC()->customer->set_is_vat_exempt( false );
        parse_str( $post_data, $output );
        
        $statecodes =array(
            'PA','MN','VT','OR','MT','AK','NH'
        );
        
        if ( in_array($output['billing_state'], $statecodes) ) 

            WC()->customer->set_is_vat_exempt( true );
            WC()->cart->calculate_shipping();
        return;
}

Leave a Reply

Your email address will not be published. Required fields are marked *