Okay
  Public Ticket #3413133
Vat exceptions php custom code
Closed

Comments

  •  4
    Mārtiņš started the conversation

    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,285
    WebWizards replied

    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