I am trying to add a form to my checkout page so when a user clicks the \'Tax Exempt\' checkbox, a textbox will popup and ask the user what the Tax Exempt Id number is.
After a long search I found that there is a method for the cart object called remove_taxes() . So, after setting a user meta for the tax exempt users, this cancels the tax totals.
function remove_tax_for_exempt( $cart ) {
global $current_user;
$ok_taxexp = get_the_author_meta( 'granted_taxexempt', $current_user->ID );
if ($ok_taxexp){ // now 0 the tax if user is tax exempt
$cart->remove_taxes();
}
return $cart;
}
add_action( 'woocommerce_calculate_totals', 'remove_tax_for_exempt' );