Public Ticket #3413133

Vat exceptions php custom code

Closed
Comments
6 Tickets 4
Mārtiņš started the conversation 3 years ago on July 13, 2023 at 12:33pm

Hello. Iw made an custom tab for single product page and have a hard time to find how can i determine if user gets price with or without VAT. This is for variable product for b2b clients. In settings it might vary if they get price with or without VAT via dynamic rules. 
Is there a way in php to determine it for a user from b2b king variables?

2,762
KingsPlugins replied 3 years ago on July 14, 2023 at 9:15am

Hi there,

Are you using "tax exemption" dynamic rules?


If so, you can simply use the following PHP function to check if the current user is VAT exempt:

WC()->customer->is_vat_exempt()

So for example,

if (WC()->customer->is_vat_exempt()){
    // yes, the user is vat exempt, 
} else {
    // no, not vat exempt
}

Kind regards,

Stefan

1

Sign In