top of page

Tax Exclude from Certain States USA WooCommerce

  • Writer: سُلَيْمَان بْن دَاوُوْد
    سُلَيْمَان بْن دَاوُوْد
  • Jan 3, 2023
  • 1 min read


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;
}


 
 
 

Recent Posts

See All
Duplicate Category in Wordpress

The following code helps to duplicate the default wordpress category by help of code. // Add Duplicate option for categories in WordPress...

 
 
 
C#.NET and Its Associated Codes

1- Creating an Desktop Application in C#.NET C# ADO.NET & MySQL MAIN C# and MySQL ADO.NET with Crystals Reports Ready Code 2- Handling...

 
 
 

Comments


© 2020 by syednazrulhassan

bottom of page