In WooCommerce, I'm trying to apply set_is_vat_exempt()
method for customer and guest user.
For logged customer it is working fine. Can anyone suggest how can I do it?
One issue could be like as the user is not logged in so may be $woocommerce->customer
could not enable it.
Here's my code:
$bilalId = get_current_user_id();
add_filter( 'woocommerce_cart_totals_order_total_html', 'wc_cart_totals_order_total_html_bn');
function wc_cart_totals_order_total_html_bn() {
global $woocommerce;
if( current_user_can('customer' || $bilalId == 0) ) {
$woocommerce->customer->set_is_vat_exempt(true);
}
}
At the end, I just want to disable any tax rates for non-logged in user.
even I tried "Zero rate" but doesn't worked for me.
Any kind of guidance would be appreciated.
Thanks.