Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce Customer Tax Exempt based on role
<?php
// 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 );
}
}
@ParadoxDesign

This comment has been minimized.

Copy link

ParadoxDesign commented Jul 17, 2013

This is great.

What do I do for multiple roles?

Also this seems to have worked on the front-end but creates a strange error when I try to go back to the admin area. I get this: http://i.imgur.com/nNHMSAZ.png

@klishb

This comment has been minimized.

Copy link

klishb commented Jun 17, 2018

This broke my site when I made it a snippet. Do I just need to create the role first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.