:::: MENU ::::

WooCommerce remove tax for user

WooCommerce remove tax for user

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,
}
Author: Qaisar Satti
Category: WooCommerce
Last Modified: September 30, 2020


So, what do you think ?