• 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

    (@daigo75)

    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

    (@densitysk)

    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

    (@daigo75)

    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. 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.