# Reverse Charge VAT for EU Business Buyers

> Removes VAT for business customers in another EU country who enter a VAT number, and adds a "reverse charge" note to the order, as cross-border B2B sales require.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, vat, tax, b2b
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-vat-reverse-charge/

## Code

```php
$wpide_eu_countries = array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );

$wpide_reverse_charge = function ( $country, $vat ) use ( $wpide_eu_countries ) {
    $base = WC()->countries->get_base_country();

    return '' !== trim( (string) $vat ) && $country !== $base && in_array( $country, $wpide_eu_countries, true );
};

add_action( 'woocommerce_checkout_update_order_review', function ( $post_data ) use ( $wpide_reverse_charge ) {
    parse_str( (string) $post_data, $posted );
    WC()->customer->set_is_vat_exempt( $wpide_reverse_charge( (string) ( $posted['billing_country'] ?? '' ), $posted['billing_vat_number'] ?? '' ) );
} );

add_action( 'woocommerce_checkout_process', function () use ( $wpide_reverse_charge ) {
    // phpcs:ignore WordPress.Security.NonceVerification -- WooCommerce verifies the checkout nonce.
    $exempt = $wpide_reverse_charge( wc_clean( wp_unslash( $_POST['billing_country'] ?? '' ) ), wc_clean( wp_unslash( $_POST['billing_vat_number'] ?? '' ) ) );
    WC()->customer->set_is_vat_exempt( $exempt );
} );

add_action( 'woocommerce_checkout_create_order', function ( $order ) {
    if ( WC()->customer && WC()->customer->get_is_vat_exempt() && $order->get_meta( '_billing_vat_number' ) ) {
        $order->update_meta_data( '_wpide_reverse_charge', 'yes' );
    }
}, 20 );

add_action( 'woocommerce_email_after_order_table', function ( $order ) {
    if ( 'yes' === $order->get_meta( '_wpide_reverse_charge' ) ) {
        echo '<p>' . esc_html( 'VAT reverse charge: the customer accounts for VAT (Article 196, Council Directive 2006/112/EC).' ) . '</p>';
    }
} );

add_action( 'woocommerce_admin_order_data_after_billing_address', function ( $order ) {
    if ( 'yes' === $order->get_meta( '_wpide_reverse_charge' ) ) {
        echo '<p><strong>' . esc_html( 'VAT reverse charge applied' ) . '</strong></p>';
    }
} );
```

## Notes

Needs the "EU VAT Number Field With Format Check" snippet for the billing_vat_number field; confirm the rules for your business with your accountant.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Reverse Charge VAT for EU Business Buyers" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
