Title: invalid country code warnings
Last modified: July 16, 2020

---

# invalid country code warnings

 *  [DensitySK](https://wordpress.org/support/users/densitysk/)
 * (@densitysk)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/invalid-country-code-warnings/)
 * HI,
 * in the recent days I have noticed a lot of warnings in logs, created by your 
   plugin.
 * Do you have any suggestion what it means?
 * [2020-07-13 21:39:19] wc-aelia-eu-vat-assistant.WARNING: Tax rate contains an
   in invalid country code {“Country Code”:””,”Rate ID”:4,”Tax Row”:”[object] (stdClass:{\”
   items_tax_amount\”:1710.029999999999972715158946812152862548828125,\”shipping_tax_amount\”:
   91.4899999999999948840923025272786617279052734375,\”refunded_items_tax_amount\”:
   0,\”refunded_shipping_tax_amount\”:0,\”items_total\”:8550.149999999999636202119290828704833984375,\”
   shipping_total\”:457.490000000000009094947017729282379150390625,\”refunded_items_total\”:
   0,\”refunded_shipping_total\”:0,\”tax_rate_data\”:{\”label\”:\”20% SK VAT\”,\”
   tax_rate\”:\”20.0000\”,\”tax_rate_country\”:\”\”,\”tax_rate_class\”:\”\”,\”is_moss\”:
   true}})”,”Tax Rate”:”[object] (stdClass: {\”label\”:\”20% SK VAT\”,\”tax_rate\”:\”
   20.0000\”,\”tax_rate_country\”:\”\”,\”tax_rate_class\”:\”\”,\”is_moss\”:true})”}{“
   process_id”:9430}
    [2020-07-13 21:39:59] wc-aelia-eu-vat-assistant.WARNING: Tax
   rate contains an in invalid country code {“Country Code”:””,”Rate ID”:4,”Tax 
   Row”:”[object] (stdClass: {\”items_tax_amount\”:1710.029999999999972715158946812152862548828125,\”
   shipping_tax_amount\”:91.4899999999999948840923025272786617279052734375,\”refunded_items_tax_amount\”:
   0,\”refunded_shipping_tax_amount\”:0,\”items_total\”:8550.149999999999636202119290828704833984375,\”
   shipping_total\”:457.490000000000009094947017729282379150390625,\”refunded_items_total\”:
   0,\”refunded_shipping_total\”:0,\”tax_rate_data\”:{\”label\”:\”20% SK VAT\”,\”
   tax_rate\”:\”20.0000\”,\”tax_rate_country\”:\”\”,\”tax_rate_class\”:\”\”,\”is_moss\”:
   true}})”,”Tax Rate”:”[object] (stdClass: {\”label\”:\”20% SK VAT\”,\”tax_rate\”:\”
   20.0000\”,\”tax_rate_country\”:\”\”,\”tax_rate_class\”:\”\”,\”is_moss\”:true})”}{“
   process_id”:14624}
 * Regards
    Michal

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

 *  Plugin Author [Diego](https://wordpress.org/support/users/daigo75/)
 * (@daigo75)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/invalid-country-code-warnings/#post-13131464)
 * As indicated in the messages, the warnings are caused by the presence of an invalid
   country code in the tax rates. There seem to be some rows without a code (empty
   code), which WooCommerce can interpret as “all countries”, but the EU VAT Assistant
   can’t use it to separate the VAT by country.
 * Every tax rate must have a valid ISO-2 country code (i.e. not an asterisk, not
   an empty value). That should be sufficient to remove the warnings.
 *  Thread Starter [DensitySK](https://wordpress.org/support/users/densitysk/)
 * (@densitysk)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/invalid-country-code-warnings/#post-13137228)
 * HI,
 * Now I am a bit confused….do the customer need to enter their VAT ID INCLUDING
   the country prefix or not?
 * I.e. SK123456789 instead of 123456789?
 *  Plugin Author [Diego](https://wordpress.org/support/users/daigo75/)
 * (@daigo75)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/invalid-country-code-warnings/#post-13137881)
 * On the checkout page, customers can enter the VAT ID with or without the country
   code. The EU VAT Assistant will “build” the VAT number automatically.
 * The “empty country code” warnings come from the data stored against existing 
   orders, they’re not related to the checkout. There are orders that have an empty
   country code inm their VAT data (see _[2020-07-13 21:39:19] wc-aelia-eu-vat-assistant.
   WARNING: Tax rate contains an in invalid country code {**“Country Code”:””**,”
   Rate ID”:4,”Tax Row”:”[object]_). That probably happened because there were tax
   rates configured with the asterisk, or no country code at all. The country code
   was taken from the tax rate, then stored in the order, and, since an asterisk
   or empty string is not a valid ISO-2 code, that raises the warning,
 * To fix this, you can try to refresh the data against the affected order. The 
   script you can find here can help with that: [https://pastebin.com/Jg4MyP9b](https://pastebin.com/Jg4MyP9b).
   In your case, you won’t need lines from 72 to 78, nor line 83. The call to `$
   order->update_vat_data();` should be sufficient to refresh the stored data and
   remove the warnings.
 * **Important**
    – We would recommend to take a full backup of the site, before
   performing any operation. The script from the link alters the data stored against
   the orders, which is an operation that can’t be undone. It’s also advisable to
   run the script using a short range of orders at a time, to verify that the data
   is updated correctly. – Before running the script, make sure that all the VAT
   rates are configured with a country code in all the tax rates set up at `WooCommerce
   > Tax > Settings`. Without a country code, the asterisk/empty value will be copied
   again, and the warnings will persist.

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

The topic ‘invalid country code warnings’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [Diego](https://wordpress.org/support/users/daigo75/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/invalid-country-code-warnings/#post-13137881)
 * Status: not resolved