Add “VAT REVERSE CHARGE” when company is from EU in WooCommerce

I have a B2B webshop with WordPress and WooCommerce using WooCommerce Subscriptions.

As I am selling digital goods I need to do add special VAT rules to my orders for companies within the EU.

My store is based in the Netherlands.

I am using this plugin to validate VAT numbers:

All is going well for companies from my own country and companies outside the EU.

But when the company is inside the EU the plugin removes all VAT lines from the order. I have contacted WooCommerce but they do not deliver custom support.

It is required for the accountants that the orders in the EU have a tax line saying: VAT REVERSE CHARGE.

My Question: I want to write a custom action which adds a VAT line to my order on checkout for EU countries only. Can someone help me get started?


You can use this simple code snippet that will do the job, displaying in the tax row on order total section, the text “Vat reverse charge” for European countries except Netherlands:

add_filter( 'woocommerce_get_order_item_totals', 'insert_custom_line_order_item_totals', 10, 3 );
function insert_custom_line_order_item_totals( $total_rows, $order, $tax_display ){
    $eu_countries = WC()->countries->get_european_union_countries( 'eu_vat' ); // Get EU VAT Countries

    unset($eu_countries['NL']); // Remove Netherlands

    if ( in_array( $order->get_billing_country(), $eu_countries ) ) {
        $order_total = $total_rows['order_total']; // Store order total row in a variable
        unset($total_rows['order_total']); // Remove order total row

        // Tax row
        $total_rows['tax'] = array(
            'label' => WC()->countries->tax_or_vat() . ':',
            'value' => strtoupper( sprintf(  __('%s reverse charge', 'woocommerce'), WC()->countries->tax_or_vat() ) ),

        $total_rows['order_total'] = $order_total; // Reinsert order total row

    return $total_rows;

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

Leave a Reply

Your email address will not be published. Required fields are marked *