Title: Specific error message
Last modified: December 4, 2019

---

# Specific error message

 *  Resolved [ABCwebsites](https://wordpress.org/support/users/abcwebsites/)
 * (@abcwebsites)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/specific-error-message/)
 * Would it be possible to indicate to customers that their VAT number cannot be
   validated through no fault of their own? I.e. tell them the remote server is 
   busy or unavailable and they should go to the Contact page for help?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Diego](https://wordpress.org/support/users/daigo75/)
 * (@daigo75)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/specific-error-message/#post-12205051)
 * At the moment, the EU VAT Assistant doesn’t have a user interface to configure
   custom error messages, but you can display one by implementing a filter for hook`
   wc_aelia_eu_vat_assistant_customer_vat_exemption`. Here’s a template, to get 
   you started:
 *     ```
       /**
        * Shows a custom error message when a VAT number could not be validated.
        */
       function show_custom_vat_error_messages() {
         // Use a hook for "wc_aelia_eu_vat_assistant_customer_vat_exemption" to check if a
         // VAT number could not be validated, and show a custom error message if that's the case
         add_filter('wc_aelia_eu_vat_assistant_customer_vat_exemption', function($customer_is_vat_exempt, $vat_country, $vat_number, $vat_number_validated, $raw_vat_validation_response) {
           if($vat_number_validated === 'could-not-be-validated') {
             wc_add_notice('Sorry, we could not validate your VAT number.', 'error');
           }
           return $customer_is_vat_exempt;
         }, 10, 5);
       }
       // Hook into the checkout process to show a custom error message when 
       // the VAT number can't be validated
       add_action('woocommerce_checkout_process', 'show_custom_vat_error_messages');
       ```
   
 * This will show a custom error message when the customer tries to complete the
   checkout and the VAT number can’t be validated. If you would like to show that
   message **every time** the validation fails (i.e. not just during the final checkout
   step), you can just use the code for the `add_filter()` call, without wrapping
   it into the `show_custom_vat_error_messages` function.
 * Please note that this code is an example, provided as-is, without implicit or
   explicit warranties, and it’s outside the scope of our support service. We recommend
   to test it on a staging site, before using it on a live site.
 *  [webbus](https://wordpress.org/support/users/webbus/)
 * (@webbus)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/specific-error-message/#post-12331910)
 * Hello Diego,
 * Could you please explain where to put the code to get this error message?
 *  [puregraphx](https://wordpress.org/support/users/puregraphx/)
 * (@puregraphx)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/specific-error-message/#post-12348080)
 * [@webbus](https://wordpress.org/support/users/webbus/) in the functions.php of
   your WP child theme

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Specific error message’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-eu-vat-assistant/assets/icon.svg?rev=1057426)
 * [EU VAT Assistant for WooCommerce](https://wordpress.org/plugins/woocommerce-eu-vat-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-eu-vat-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-eu-vat-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-eu-vat-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-eu-vat-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-eu-vat-assistant/reviews/)

## Tags

 * [error message](https://wordpress.org/support/topic-tag/error-message/)

 * 3 replies
 * 4 participants
 * Last reply from: [puregraphx](https://wordpress.org/support/users/puregraphx/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/specific-error-message/#post-12348080)
 * Status: resolved