View gist:7b81c3b2b37b592b39e9c2d1da703da9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply a different tax rate based on the user role. | |
*/ | |
function wc_diff_rate_for_user( $tax_class, $product ) { | |
$tax_class = 'zero-rate'; | |
// Getting the current user | |
$current_user = wp_get_current_user(); | |
$current_user_data = get_userdata($current_user->ID); | |
if ( is_user_logged_in() && | |
in_array( 'au_export_trade_45', $current_user_data->roles ) || |
View gist:1d0447d2d3c218ee23a13c57dd4eeceb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply a different tax rate based on the user role. Updated 2017 | |
*/ | |
function wc_diff_rate_for_user( $tax_class, $product ) { | |
$user_id = get_current_user_id(); | |
$user_data = get_userdata($user_id); | |
if ( is_user_logged_in() && | |
in_array( 'au_export_trade_45', $user_data->roles ) || | |
in_array( 'row_trade_45', $user_data->roles ) || | |
in_array( 'row_distributor', $user_data->roles ) || |