Add Tax Exempt form on checkout in woocommerce

前端 未结 5 2173
孤独总比滥情好
孤独总比滥情好 2021-01-03 03:14

I am trying to add a form to my checkout page so when a user clicks the \'Tax Exempt\' checkbox, a textbox will popup and ask the user what the Tax Exempt Id number is.

5条回答
  •  感情败类
    2021-01-03 04:14

    Since this answer still pops up on google, I thought I'd share that setting the customer as tax exempt only works during checkout, if you need to edit the order on the back-end after it is placed and use the "recalculate" button, the taxes will still appear. Fortunately there is a hook for this as well:

    function remove_tax_for_exempt($exempt, $order){
        return $exempt || user_can($order->get_user_id(), 'wholesale_customer');
    }
    
    add_filter('woocommerce_order_is_vat_exempt', 'remove_tax_for_exempt', 10, 2);
    

提交回复
热议问题