Have you ever needed to remove sales tax for a specific user role in WooCommerce? A commom instance of this application would be for re-sale customers shopping at your store which in many states are not required to pay tax. I am going to show you how to remove sales tax/VAT for specific user roles.
First you are going to want to create a unique user role within WordPress. I do this with the User Role Editor plugin. This plugin is easy to use with many features to customize user roles.

Once you have the plugin installed you are going to navigate to Users –> User Role Editor in the WordPress admin sidebar. When the page loads click “Add Role”.

Make sure to take note of the Role Name (ID) field you enter. You will need this for the code later.
Next you are going to want to head over to Appearance —> Editor to make some modifications to your functions.php file. Some WordPress installations will have the editor disabled for security reasons. If this is the case it is easiest to modify the file via FTP. Make sure to be using a child theme so you won’t lose your updates when your theme is updated. Paste the code below into your child theme functions.php file.
/**
* Function that will check for user role and turn off VAT/tax for that role
*/
function wc_diff_rate_for_user() {
// check for the user role
if ( is_user_logged_in() && current_user_can( 'role-1' ) ) {
// set the customer object to have no VAT
WC()->customer->is_vat_exempt = true;
}
}
add_action( 'template_redirect', 'wc_diff_rate_for_user', 1 );
/**
* Function that filters the variable product hash based on user
*/
function wc_get_variation_prices_hash_filter( $hash, $item, $display ) {
// check for the user role
if ( is_user_logged_in() && current_user_can( 'role-1' ) ) {
// clear key 2, which is where taxes are
$hash['2'] = array();
}
// return the hash
return $hash;
}
add_filter( 'woocommerce_get_variation_prices_hash', 'wc_get_variation_prices_hash_filter', 1, 3 );
/**
* Function that removes the price suffix (inc. Tax) from variable products based on role
*/
function wc_get_price_suffix_filter( $price_display_suffix, $item ) {
// check for the user role
if ( is_user_logged_in() && current_user_can( 'role-1' ) ) {
// return blank if it matches
return '';
}
// return if unmatched
return $price_display_suffix;
}
add_filter( 'woocommerce_get_price_suffix', 'wc_get_price_suffix_filter', 10, 2 );







