Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce EU VAT plugin relies on the Europa VIES service. But when it's down your customers get an annoying error and the order cannot be completed. This snippet provides a fix.
<?pp
/*
!!! Just a quick warning, if WooCommerce updates its plugin these changes will be gone !!!
1) Find class-wc-eu-vat-number.php, it's located under wp-contents/plugins/woocommerce-eu-vat-number/includes
2) Skim trough until you find line 160
3) Do the following
*/
/* On line 160 you'll find this line of code */
return new WP_Error( 'api', sprintf( __( 'VAT API Error: %s', 'woocommerce-eu-vat-number' ), $response->get_error_message() ) );
/* Replace line 160 with the following */
if( strstr($response->get_error_message(), 'cURL error 28') !== false ){
// fail silently and let order go through
return true;
} else {
return new WP_Error( 'api', sprintf( __( 'VAT API Error: %s', 'woocommerce-eu-vat-number' ), $response->get_error_message() ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.