Remove taxes from cart total during checkout
-
I am trying to set up a way for customers to be tax exempt. Currently, my cart charges state sales tax for customers in Wisconsin, US. I have added a tax exemption field to the checkout and account pages and tied those fields to the user meta data.
I’m using get_user_meta($current_user->ID, ‘aacer_tax_exempt’, true) to check their tax exempt status and everything is working so far.
Now, when a user is tax exempt and they are on the checkout page I want to remove the tax from the cart total.
I found this snippet on stackoverflow that allowed me to modify the cart prices:
add_action( ‘woocommerce_before_calculate_totals’, ‘add_custom_price’ );
function add_custom_price( $cart_object ) {
$custom_price = 10; // This will be your custome price
foreach ( $cart_object->cart_contents as $key => $value ) {
$value[‘data’]->price = $custom_price;
}
}
But I can not make it work for taxes.Anybody have any ideas how to remove the taxes from the cart total during checkout? Thank you!
- The topic ‘Remove taxes from cart total during checkout’ is closed to new replies.