Plugin does not exempt VAT for companies in my own country

Forums › WooCommerce EU & UK VAT Numbers Validation – Support Forum › Plugin does not exempt VAT for companies in my own country

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #184672
    joukeschotanus
    Participant

    Hello Support,

    I have the EU/UK VAT Validation Manager for WooCommerce plugin activated and set up in my checkout page.

    Everything seems to work fine, unless when you fill in a valid Dutch VAT number (my store is in The Netherlands and the Dutch shop address is also inserted correctly in the WooCommerce settings). Then after placing an order, it still exempts the VAT of that order, even though I have set in the settings of the EU VAT validation plugin that it should not exempt the VAT for all customers in my own billing country (the Netherlands).

    Moreover, my developer added custom PHP code in the functions.php file of my child theme to try and bypass this, but without any results. All the other functions seem to work, except this one.

    So the only thing that is not working now is that: when a Dutch company fills in a valid Dutch VAT number, the plugin still exempts the VAT for that order, in the back end and on the invoice (but keeps the total price the same like being set in the PHP code). It should however keep the price the same, and keep the 21% VAT for both Dutch consumers and companies.

    Why exactly is this setting not working properly? Or how else can I achieve this so that Dutch companies always just have to pay the 21% VAT and the plugin does not exempt Dutch companies from VAT anymore?

    Please note: With all the other countries except the Netherlands the VAT must be exempted for companies abroad. This is working fine. It’s only not working when a Dutch company with a valid VAT number is placing an order.

    Thank you in advance.

    —————-

    The PHP code in my child theme:

    /**

    • THE FINAL ENFORCER (TAX RATE OVERRIDE)
    • We vertellen WooCommerce dat NL klanten NOOIT in aanmerking komen voor nul-tarief.
      */

    // 1. Zorg dat de prijsweergave op de site en in de backend niet verspringt
    add_filter('woocommerce_prices_include_tax', 'ok_keep_price_fixed_on_exempt', 9999);
    function ok_keep_price_fixed_on_exempt($return) {
    if (isset(WC()->customer) && WC()->customer->is_vat_exempt()) {
    return false;
    }
    return $return;
    }

    // 2. Pas de berekening aan: Altijd backend prijs voor buitenland, normaal voor NL
    add_filter('woocommerce_get_price_excluding_tax', 'ok_fix_exempt_price', 9999, 3);
    add_filter('woocommerce_get_price_including_tax', 'ok_fix_exempt_price', 9999, 3);
    function ok_fix_exempt_price($price, $qty, $product) {
    $is_exempt = false;
    $customer_country = '';

    if (isset(WC()->customer)) {
        $is_exempt = WC()->customer->is_vat_exempt();
        $customer_country = WC()->customer->get_billing_country();
    }
    
    if (is_admin() && !empty($_GET['post'])) {
        $order = wc_get_order($_GET['post']);
        if ($order) {
            $is_exempt = $order->get_customer_id() ? get_user_meta($order->get_customer_id(), 'is_vat_exempt', true) : false;
            $customer_country = $order->get_billing_country();
        }
    }
    
    if ($is_exempt && $customer_country !== 'NL') {
        return $product->get_price() * $qty;
    }
    
    return $price;

    }

    // 3. DE KERNOPLOSSING: Forceer de belastingklasse.
    // Zelfs als de plugin de klant ‘exempt’ maakt, dwingen we hier de 21% BTW terug.
    add_filter('woocommerce_product_get_tax_class', 'ok_force_tax_class_nl', 9999, 2);
    add_filter('woocommerce_product_variation_get_tax_class', 'ok_force_tax_class_nl', 9999, 2);
    function ok_force_tax_class_nl($tax_class, $product) {
    if (is_admin() && !defined('DOING_AJAX')) return $tax_class;

    if (isset(WC()->customer) && WC()->customer->get_billing_country() === 'NL') {
        // We dwingen de standaard belastingklasse (21%) af voor Nederland.
        return '';
    }
    
    return $tax_class;

    }

    // 4. Locatie-fix
    add_filter('woocommerce_adjust_non_base_location_prices', '__return_false', 9999);

    • This topic was modified 6 months, 2 weeks ago by Taha. Reason: Removed HTML Tags
    #184675
    joukeschotanus
    Participant

    Sorry I don’t know why it added all those html tags. I can’t edit this anymore

    #184714
    Hindi
    Participant

    Hi Adam,

    Please check the following:

    • Set tax calculation based on billing address (WooCommerce → Tax settings)
    • EU VAT → Advanced settings Enable Debug (EU VAT → Advanced) and check logs
    • EU VAT → Advanced settings Try changing Session type
    • EU VAT → Advanced settings Enable Force VAT recheck on checkout
    • Make sure these are enabled:
      • Keep VAT in selected countries = Base country
      • Keep VAT if shipping country matches store base country

    Test again and let us know if it still happens

    Regatds,

    A.Hindi

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.