View Categories

VIES VAT Validation Blocked (IP_BLOCKED): Alternative VAT Validation in WooCommerce

VIES IP blocking and alternative VAT validation #

If your VAT validation log shows IP_BLOCKED, the VIES service has blocked your server’s IP, so EU/UK VAT Manager for WooCommerce cannot reach it. The workaround is to route validation through a third-party API, such as Vatlayer, with a code snippet that uses the alg_wc_eu_vat_validation_response filter, added with a plugin like Code Snippets.

The symptom #

VIES (VAT Information Exchange System), run by the European Commission, is the primary service for validating EU VAT numbers. When a server IP is blocked, validation returns failed or unknown responses and your log shows IP_BLOCKED.

IP_BLOCKED entry in the EU VAT validation log

The European Commission does not publish the exact criteria, but blocks often affect shared hosting or servers making high request volumes. Moving to a new host or IP can fix it but is usually impractical.

Workaround: route validation through a third-party API #

The plugin exposes the alg_wc_eu_vat_validation_response filter, which lets you replace the validation response with one from another service. The example below uses Vatlayer, which offers a free tier.

Step 1: install a snippet manager #

Add the code with a plugin such as Code Snippets so you do not edit your theme’s functions.php.

Step 2: add the snippet #

Create a new snippet and paste the code below. Replace the placeholder key with your own Vatlayer API key.

add_filter(
	'alg_wc_eu_vat_validation_response',
	function ( $response, $method, $country_code, $vat_number ) {
		$key = 'YOUR_KEY_HERE'; // set your Vatlayer key
		$url = "https://apilayer.net/api/validate?access_key={$key}&vat_number={$country_code}{$vat_number}";
		$curl = curl_init( $url );
		curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
		curl_setopt( $curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
		$res = curl_exec( $curl );
		curl_close( $curl );
		if ( $res ) {
			$res = json_decode( $res, true );
			$response = json_encode( array(
				'isValid'   => $res['valid'],
				'name'      => $res['company_name'],
				'address'   => $res['company_address'],
				'vatNumber' => $res['vat_number'],
			) );
		}
		return $response;
	},
	10,
	4
);

Step 3: test #

With the snippet active and your key in place, run a test validation on the checkout or in the plugin settings and confirm the number now validates.

Built-in alternative: VATSense #

For UK, Australian, Norwegian and Swiss numbers, the plugin already integrates VATSense. You can also enable Enable VATSense fallback on the Validation sub-tab (a VATSense API key is required) so VATSense is used when VIES is unavailable. See VATSense validation for UK and non-EU numbers.

Need a hand? #

Our team answers every ticket on the EU/UK VAT Manager support forum.