• Resolved gchron

    (@gchron)


    Hello
    I am trying the EU VAT Assistant plugin

    I think that I can use it for my work. I just think that I need something I cannot find. I would like to change the user role to a validated one (I can create this role in WordPress). So if someone is validated I could change the role.

    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Diego

    (@daigo75)

    The EU VAT Assistant doesn’t change user roles. It’s mostly a reporting plugin, and it’s designed not to “touch” data unless necessary.

    If you would like to set the role after the completion of an order when the VAT number is valid, you can implement your own custom function upon checkout. Here’s a “rough” example, to get you started:

    
    add_filter('wc_aelia_eu_vat_assistant_customer_vat_exemption', function($customer_vat_exemption, $vat_country, $vat_number, $vat_number_validated, $raw_vat_validation_response) {
      global $vat_number_validated_result;
      // Store the result of the VAT validation, which will be used later
      $vat_number_validated_result = $vat_number_validated;
    
      return $customer_vat_exemption;
    }, 10, 5);
    
    add_action('woocommerce_checkout_process', function() {
      global $vat_number_validated_result;
      if($vat_number_validated_result === 'valid') {
        // VAT number is valid, do what you need to do
      }
    }, 99);
    

    If you need assistance developing a complete customisation, we provide that service too. In such case, please feel free to get in touch and we will get back to you with an estimate. Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Can EU VAT Assistant change the user role if VAT is validated?’ is closed to new replies.