Forum Replies Created

Viewing 15 replies - 1 through 15 (of 1,143 total)
  • I encountered the same issue, and I was able to reproduce it on a local WooCommerce 10.5 installation, with the Storefront theme. The block checkout stopped working on the frontend, so I checked the backend and the page shows the same error reported in this discussion.

    The checkout block also doesn’t appear in the list of available blocks. I haven’t been able to identify the source of the issue. It simply looks like the checkout block is no longer there.

    Note: I tried to add some screenshots, but this editor doesn’t seem to work, either. Every time I add an image, it hangs.

    Plugin Author Diego

    (@daigo75)

    Hello @moesioli,
    The incompatibility is known. As indicated on the plugin description, the EU VAT Assistant reached its end of life in June 2022. It’s no longer actively developed, we can no longer provide support for it, nor guarantee updates (with the exception of the occasional tweak). We are keeping the plugin available for users who still use it, and might need to access its code. This is mainly for the convenience of developers who wish to read the code, or build upon it.

    Due to this, there are no plans to further update the plugin to support the HPOS storage. We would recommend to switch to an alternative solution, which already supports that feature, as well as integrations with other VAT number systems (e.g. UK, Norway).

    For reference, another user asked about contributing to the plugin, and we explained to him that it would be easier to switch to the plugin we recommend, than to develop all the required new features. You can refer to the previous conversation here: https://ww.wp.xz.cn/support/topic/hpos-support-i-would-like-to-contrubute/.

    Plugin Author Diego

    (@daigo75)

    As indicated on the plugin description, the EU VAT Assistant reached its end of life in June 2022. It’s no longer actively developed, we can no longer provide support for it, nor guarantee updates (with the exception of the occasional tweak). We are keeping the plugin available for users who still use it, and might need to access its code. This is mainly for the convenience of developers who wish to read the code, or build upon it.

    Due to this, there are no plans to further update the plugin to support the HPOS storage. We would recommend to switch to an alternative solution, which already supports that feature, as well as integrations with other VAT number systems (e.g. UK, Norway).

    For reference, another user asked about contributing to the plugin, and we explained to him that it would be easier to switch to the plugin we recommend, than to develop all the required new features. You can refer to the previous conversation here: https://ww.wp.xz.cn/support/topic/hpos-support-i-would-like-to-contrubute/.

    Edit
    If your client raises any objection about your suggestion of switching to another plugin, please refer them to the links I posted. They are official announcements, which make it clear that the EU VAT Assistant is no longer supported and that its authors recommend moving to a solution that is actively maintained.

    • This reply was modified 5 months, 3 weeks ago by Diego.
    Plugin Author Diego

    (@daigo75)

    When an order is zero rated, WooCommerce doesn’t apply VAT to it. The calculation of VAT simply doesn’t take place. As far as we know, there isn’t an information such as “the VAT that would have been added to this order had the exemption not be applied“. WooCommerce doesn’t seem to offer it, and the EU VAT Assistant doesn’t have that, either, because our plugin doesn’t calculate taxes and it’s not involved in the process.

    If you need to show the tax that would have applied to the order, you will need to calculate it yourself using some custom code. That involves exclusively WooCommerce core functions, nothing from the EU VAT Assistant. Any WooCommerce developer should be able to do that for you.

    Important
    However, before starting to work on a customisation, please note that the EU VAT Assistant reached its end of life in June 2022. The plugin is no longer actively developer, and we can no longer provide support for it, nor guarantee updates. We are keeping the plugin available for users who still use it, and might need to access its code, but it could be a good idea to switch to an alternative solution, which will be supported in the long term. The VAT Compliance plugin developed by Simba Hosting is the plugin we recommend to replace the EU VAT Assistant. It offers a similar feature set, plus additional features for countries like the UK or Norway. It’s also possible that it offers additional features to cover your requirements, with less coding.

    Plugin Author Diego

    (@daigo75)

    Hi Marco,

    There isn’t a public Github repository for the EU VAT Assistant, because it was due to be replaced by a premium plugin before we realised that it wasn’t a viable option. If you wish to try adding HPOS support to it, you could do it locally and then forward me the changes. It’s possible that there are relatively few changes to be made, mostly in the reports, but the issue remains that we can no longer provide support for the plugin even after the update.

    In addition to that, the HPOS support is only one of the aspects that would need to be covered. There have been developments in the VAT MOSS system, which is now VAT OSS, and similar regulations have been introduced in countries like UK and Norway. The EU VAT Assistant can be extended to integrate with new systems (years ago we prepared an addon for the UK, and even managed to make the HMRC change their policies to accommodate it), but doesn’t handle them out of the box, therefore you would have to implement that too.

    Due to this, the recommendation is to switch to an alternative solution (e.g. https://ww.wp.xz.cn/plugins/woocommerce-eu-vat-compliance/) that already supports the HPOS feature, as well as the additional tax regimes. Depending on the client, a data migration could be required, but then you would be able to keep using the new solution, with all the new features, without implementing and maintaining them yourself.

    For the benefit of anyone who reads this conversation, we are currently distributing an update of our Aelia Currency Switcher that includes a safeguard to prevent the data duplication. The update server rolls out new versions in batches, if the update is not visible it will become available shortly.

    @hansderuiter thanks for your feedback. It’s curious, because we haven’t been able to trigger the issue on any of our test servers, with our without the HPOS feature enabled. On a customer’s site, it only occurs with the HPOS feature disabled.

    It looks like there is some other element that comes into play, and the fact that the condition in which the glitch occurs is so “nonsensical” is curious to say the least. In any case, the fix we put together is working, so the error should be prevented for the time being.

    Just a quick update for the readers to inform that we found the quirk that causes the data duplication. It’s actually linked to the WooCommerce core. We have a piece of logic that changed slightly. Here’s an example of what changed, simplified for easier understanding:

    add_action('woocommerce_after_order_object_save', function(WC_Order $order) {
    $exchange_rate = get_exchange_rate();
    $order->update_meta_data('_order_total_base_currency', $order->get_total() * $exchange_rate);
    $order->update_meta_data('_order_total_tax_base_currency', $order->get_total_tax() * $exchange_rate);
    // Save more meta, converting order properties

    // Save the exchange rate last
    $order->update_meta_data('_base_currency_exchange_rate', $exchange_rate);
    $order->save_meta_data();
    });

    To this:

    add_action('woocommerce_after_order_object_save', function(WC_Order $order) {
    $exchange_rate = get_exchange_rate();
    // Save the exchange rate first
    $order->update_meta_data('_base_currency_exchange_rate', $exchange_rate);

    $order->update_meta_data('_order_total_base_currency', $order->get_total() * $exchange_rate);
    $order->update_meta_data('_order_total_tax_base_currency', $order->get_total_tax() * $exchange_rate);
    // Save more meta, converting order properties

    $order->save_meta_data();
    });

    For reasons that I can’t explain, if action woocommerce_after_order_object_save is triggered more than once, the behaviour will be different in the two cases:

    1. In the first case, the call to $order->update_meta_data('_base_currency_exchange_rate', $exchange_rate); adds the meta the first time and updates it the second time.
    2. In the second case, the call to $order->update_meta_data('_base_currency_exchange_rate', $exchange_rate); adds the meta twice, resulting in data duplication.

    We couldn’t figure out the reason behind this inconsistent behaviour. The only speculation, which hasn’t been proven, is that calling the WC_Order::get_total(), WC_Order::get_total_tax() and so on causes the custom meta set by WC_Order::update_meta_data() to be “forgotten”, so to speak, despite the call to WC_Order::save_meta_data(). I’m aware that it doesn’t make much sense, but the test results are consistent. Saving the exchange rate last doesn’t cause any duplication, for some reason.

    We’re now implementing a safeguard, so that the meta won’t be duplicated despite this unexpected behaviour.

    Additional note
    So far, we’ve only noticed this behaviour on a site with the HPOS feature disabled, where the orders are stored in the wp_posts table. With the HPOS feature enabled, this doesn’t seem to happen. However, we will run more tests to check if that actually makes a difference.

    • This reply was modified 1 year, 7 months ago by Diego. Reason: Added note about HPOS

    @brentst I don’t think that the filter should have any role in the issue. You can try disabling it, but it shouldn’t make a difference. The change that the Currency Switcher does is a simple JOIN that changes the data returned, whereas the filter is a WHERE clause to reduce the set of orders. Those can work together.

    Please follow the instructions you received when you open the support ticket with us, then we can continue the conversation through the support portal. We’re closed for the weekend now (and tomorrow is also a national holiday), but I will make sure that you get a reply in a timely manner.

    For the benefit of anyone else who’s reading, the Aelia Currency Switcher doesn’t change how the Analytics works. It just adds a JOIN to the query, to multiply the order amounts by an exchange rate, preventing order totals in different currencies from being added together. Out of the box, the Analytics could calculate a grand total as in “100 USD + 100 EUR + 100 GBP = 300 USD”. By adding the exchange rate, the calculation becomes “100 USD + 100 EUR x <USD exchange rate> + 100 GBP x <USD exchange rate>”. That’s the only difference between the “vanilla” calculation and the multi-currency one.

    There haven’t been any changes in recent updates of the Currency Switcher, and, based on our tests, the recent changes in the Analytics don’t seem to affect the existing integration logic, either. The most likely cause of the issue is the presence of duplicate data. There must be only one exchange rate per order, but if more are present, the JOIN would match and return multiple rows. That would explain the discrepancy:

    1. With the Currency Switcher enabled, the JOIN to fetch the exchange rate for each order matches all the duplicate rows. The affected orders are processed multiple times.
    2. With the Currency Switcher disabled, the JOIN to fetch the exchange rate is no longer there, and the duplicate rows don’t have any effect.

    We’re now assisting the customer to verify this hypothesis, find the duplicate data and clean it up. That should be sufficient to fix the calculations.

    Plugin Author Diego

    (@daigo75)

    I would suggest to try contacting the authors of the VAT Compliance plugin (i.e. this one: https://ww.wp.xz.cn/plugins/woocommerce-eu-vat-compliance/). They might also have a solution for Switzerland.

    Plugin Author Diego

    (@daigo75)

    Unfortunately, we can’t suggest an alternative plugin, because we haven’t tried any other. You could search for “VAT compliance” in the plugin repository, and try the ones that come up.

    Diego

    (@daigo75)

    I’m not sure how adding a currency code to the settings of an integration could affect conversions, but that’s not the issue in this case.

    To answer your question, there is a currency selector, which the client is not using. The selector reloads the whole page with the new currency, so that would not cause any issue. The only discrepancy can occur when there is one currency at page load, and another when the order is placed. That can happen most frequently in the scenario I already described, hence my suggestion.

    I would be more than happy to provide you with a development licence. If you have an email address to which I could send it, I will do that as soon as possible.

    Diego

    (@daigo75)

    I’m the author of the Aelia plugin mentioned, I’ve been asked to look into this. Based on what we have seen on the site, that’s not an issue on our side. However, the root cause does seem to be the one described:

    It would seem there is a disconnect between the currency provided when the JS script is loaded, and what’s being used server side when API requests are made

    This is a slightly imprecise statement, but it’s in the right direction. In a multi-currency environment, the functions get_woocommerce_currency() and WC_Order::get_currency() may or may not return the same value. The former returns the active currency at a given time, which may change depending on the context, whereas WC_Order::get_currency() always returns the currency in which an order is placed. The two are not the same thing, and can’t be used interchangeably.

    In the specific case reported by @henrybaum , the site is using multiple currencies, and it’s configured so that when a customer chooses a country at checkout, the currency in which the order is being placed changes as well. For example, a customers choosing US will see USD, a customer choosing UK will see GBP, and so on. Due to that, the following can happen:

    1. When the checkout page is loaded, the currency is USD. Calling get_woocommerce_currency() returns USD.
    2. The customer changes the country to France. WooCommerce triggers a “refresh order” event, which is a fetch/Ajax call (i.e. it doesn’t refresh the page). The call passes the newly selected country (Spain) and that changes the currency to EUR.
    3. The customer places the order. The order is placed in EUR, as it should be.

    The “disconnect” between the currency on page load and the one after the checkout refresh is not due to an error, it’s due how the system works. Quite simply, at the time of a “page load” event it’s not possible to determine with certainty in which currency an order will be placed. Fetching the currency at that time could lead to a discrepancy when the checkout is actually started.

    Suggested solution

    To address the issue during the payment process, the currency to be used for payments should only be fetched from the order when it’s placed. That value never changes (our Currency Switcher doesn’t even take part into the payment process, and never alter existing orders). If you need to build a URL for the PayPal SDK, then the currency should be stored into a variable and added to the URL as the second to last step, just before calling the PayPal service.

    For the sake of clarity, this behaviour is nothing new. The currency selection has been working this way for at least a decade. The fix I described is something we recommended to other developers, and it should be sufficient to prevent the error.

    Plugin Author Diego

    (@daigo75)

    It’s possible that the VAT is still applied due to an incorrect configuration, or due to an error in the response from the remote validation service. The following FAQ can help you troubleshooting this issue: https://ww.wp.xz.cn/support/topic/faq-vat-is-not-deducted-when-entering-a-valid-vat-number/

    Important
    The EU VAT Assistant reached its end of life in June 2022 and we can no longer provide support for it, nor guarantee updates. We are keeping the plugin available for users who still use it, and might need to access its code, but we would recommend to contact your developers if you need assistance tweaking or troubleshooting it.

Viewing 15 replies - 1 through 15 (of 1,143 total)