<?php /** * Apply a different tax rate based on the user role. */ function wc_diff_rate_for_user( $tax_class, $product ) { if ( is_user_logged_in() && current_user_can( 'administrator' ) ) { $tax_class = 'Zero Rate'; } return $tax_class; } add_filter( 'woocommerce_product_tax_class', 'wc_diff_rate_for_user', 1, 2 );