• Resolved BenLinders

    (@benlinders)


    I get this error:

    PHP Fatal error: Class ‘Aelia\WC\EU_VAT_Assistant\InvalidArgumentException’ not found in /home/public/sites/xxx/wp-content/plugins/woocommerce-eu-vat-assistant/src/plugin-main.php on line 652

    This happens when I try to do a payment in USD shop currency while VAT is set to Euro. For payments in EUR shop currency, it works ok.

    What is going wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Diego

    (@daigo75)

    The error message you get is due to a typo in the code (there’s a call to InvalidArgumentException, where it should be \InvalidArgumentException). Fixing that will be simple enough, I will add this to the next update. However, there’s still the underlying issue of the currencies, which is the reason why the InvalidArgumentException is thrown in the first place.

    The EU VAT Assistant only supports our Aelia Currency Switcher for the multi-currency aspect (there are other plugins with the same name, but they are not ours and not supported by us).
    When the EUVA loads the exchange rates, it queries the Currency Switcher to find out which currencies are enabled in it, and fetches the rates for those currencies.

    If the Currency Switcher is not installed, then the EU VAT Assistant will only handle the shop’s base currency. Due to that, when you try to place an order in another currency, the EU VAT Assistant doesn’t have an exchange rate and throws an error. The error you will see will be something like “Currency conversion – Source currency not valid or exchange rate not found for: “USD”. Please make sure that the EU VAT assistant plugin is configured correctly and that an Exchange Rate has been specified for each of the available currencies.

    How to fix the issue
    As indicated, the EU VAT Assistant was only tested with our Aelia Currency Switcher. Installing it will solve the issue.

    If you don’t want to use that plugin, you can try implementing a filter for the wc_aelia_cs_enabled_currencies hook. Your filter should return an array of currency codes, as in the following example:

    add_filter('wc_aelia_cs_enabled_currencies', function($currencies) {
      // Add currencies as needed
      return array('EUR', 'USD', 'GBP', 'AUD');
    }, 10, 1);

    Please note that, while this filter should remove the original cause of the error message, we can’t guarantee that this will be sufficient to solve all multi-currency related issues. As of today, multi-currency plugins other than our Currency Switcher are not supported.

    Thread Starter BenLinders

    (@benlinders)

    Thanks Diego!

    I didn’t add the Aelia Currency Switcher as I had booster installed already which provides currency switching for two currencies (which is enough for now).

    I added the code. But as you mention, it’s only part of the solution as it suppresses the error but doesn’t provide an exchange rate. Do you have a function for that too?

    There still is another problem where there is a empty error messages that customers get on the checkout page. I haven’t been able to trace and debug it yet.

    Plugin Author Diego

    (@daigo75)

    It’s a speculation, but it might be possible that you just have to save the EU VAT Assistant settings again, so that it will fetch the exchange rates. I can’t guarantee that it will work (it’s an unsupported configuration), but it might be worth to give it a try.

    Regarding the Booster plugin
    As explained, the only supported multi-currency solution at the moment is our own Currency Switcher. We haven’t tested the Booster plugin, nor other multi-currency solutions. Due to that, we wouldn’t be able to say how it should be integrated with the EU VAT Assistant.

    If you need an integration for the Booster plugin, you can contact us directly. We can perform an analysis of the Booster plugin and prepare an estimate for the implementation.

    Note
    Based on past experience, and even on our cheapest rate, writing an integration for the Booster plugin will most likely be more expensive the Currency Switcher itself.

    Thread Starter BenLinders

    (@benlinders)

    Thanks Diego. I switched between USD and EUR to enter exchange rates for EU VAT and that seems to work now.

    But then I saw another error in my log:

    PHP Fatal error: Class ‘Aelia\WC\Aelia_Plugin’ not found in /home/public/sites/www.benlinders.com/wp-content/plugins/woocommerce-eu-vat-assistant/src/plugin-main.php on line 21

    Unsure what triggered this.

    Plugin Author Diego

    (@daigo75)

    That error indicates that the Aelia Foundation Classes (AFC) have not been installed, or could not be loaded. Usually, reinstalling them fixed the issue. To do so:

    1. Go to WordPress > Plugins.
    2. Deactivate and remove the Aelia Foundation Classes. The EU VAT Assistant will “complain” about it, showing a message. You can ignore it, it simply tells you that, without the AFC, the EU VAT Assistant won’t work (it’s normal).
    3. Reload the Plugins page. The EU VAT Assistant will offer to install the AFC automatically. Just click on “Install” to do so.

    That should remove the error.

    • This reply was modified 6 years, 9 months ago by Diego.
    Thread Starter BenLinders

    (@benlinders)

    Thanks Diego, done this.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error with VAT exchange rate’ is closed to new replies.