Skip to content

Woocommerce Role Based Taxes or Prevent Wholesaler Shipping Tax

While creating a Woocommerce product you can indicate whether or not the product is taxable using the Tax Status and Tax Class fields. But if you’ve enabled Shipping Tax in Woocommerce settings, then wholesale customers will still see a shipping tax. My solution: add a Woocommerce role based tax exempt filter to the child theme. It overrides Woocommerce settings with tax exempt status before checkout based on the user’s role.

In my example, I’ve 4 User Roles who receive tax exempt status: wholesale_customer, discount-one-no-tax, full-no-tax, and shop_manager.

//RoleBasedTaxWoocommerce
add_filter( 'woocommerce_before_checkout_billing_form', 'woocommerce_before_cart_contents', 'woocommerce_before_shipping_calculator', 'prevent_wholesaler_taxes' );

function prevent_wholesaler_taxes() {

global $woocommerce;

if( current_user_can('wholesale_customer')||current_user_can('discount-one-no-tax')||current_user_can('full-no-tax')||current_user_can('shop_manager') ) {

$woocommerce->customer->set_is_vat_exempt(true);

} else {

$woocommerce->customer->set_is_vat_exempt(false);
}
} //end prevent_wholesaler_taxes

There may be other solutions but this one seems to cover the issue.

Menu Title
Scroll To Top