Today we talk about how in WooCommerce remove tax for user. We will remove the tax on basis of the user id or user groups. Now, let’s start with our example.
add_filter( 'wc_tax_enabled', 'custom_enable_tax' , 1, 2 );
function custom_enable_tax(){
$user = wp_get_current_user(); //get current user
if( '20' == $user->ID ){
return false;//remove tax for current user on basis of id
}
if( 'customer' == $user->roles[0] ){
return false; //remove tax for current user on basis of user group
}
return true,
}
function custom_enable_tax(){
$user = wp_get_current_user(); //get current user
if( '20' == $user->ID ){
return false;//remove tax for current user on basis of id
}
if( 'customer' == $user->roles[0] ){
return false; //remove tax for current user on basis of user group
}
return true,
}