Change WordPress user roles and capabilities Forums How to or FAQ Make Roles Tax Exempt (Woocommerce)

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #6115
    AGB
    Participant

    Hi Vladimir,
    I’m trying to make our custom reseller roles tax exempt. In the past (WC 2.6.x) we used this snippet in child theme functions.php, which worked on checkout page to remove sales tax for those roles.

    add_filter( 'woocommerce_checkout_before_order_review', 'prevent_wholesaler_taxes' );
    function prevent_wholesaler_taxes() {
         global $woocommerce;
         if (current_user_can('dealer_level1') || current_user_can('dealer_level2') || current_user_can('dealer_level3') || current_user_can('dealer_level4') || current_user_can('dealer_level5') || current_user_can('dealer_level6') || current_user_can('distributor_level1') || current_user_can('distributor_level2') || current_user_can('distributor_level3')) {
              $woocommerce->customer->set_is_vat_exempt(true);
          } else {
              $woocommerce->customer->set_is_vat_exempt(false);
          }
    }
    

    I’m testing stuff in staging site (now WC 3.7.1) and that no longer works. Have searched and tried other things too but nothing working out yet.

    Ideally we would have these roles tax exempt in such a way that it’s never included on Cart or Checkout or anywhere for them at all. What is the best way to achieve this? Possible to create tax exempt capability then be able to apply to specific roles in URE interface?

    Thanks for any help you can offer.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.