I am trying to set up a woocommerce store so that users who have a role of wholesaler or designer will automatically be exempt from tax and just have tax disappear from the cart/checkout. I've used the dynamic pricing plugin to provide different prices to different roles but there is no options for tax variations.
Someone posted this code:
// Place the following code in your theme's functions.php file and replace tax_exempt_role with the name of the role to apply to
add_action( 'init', 'woocommerce_customer_tax_exempt' );
function woocommerce_customer_tax_exempt() {
global $woocommerce;
if ( is_user_logged_in() ) {
$tax_exempt = current_user_can( 'tax_exempt_role');
$woocommerce->customer->set_is_vat_exempt( $tax_exempt );
}
}
This seems to be working on the front end but breaks the backend. after adding it to functions.php when i go back into the admin area and see this: http://i.imgur.com/nNHMSAZ.png (is this just the new chrome error page?)
The other thing I couldn't figure out is how to add 2 roles instead of just one.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…