1
votes

Note - im new, so please be kind. If anything isnt clear please tell me, so i can improve my questioning!

As a person who lives in europe and sells products to end-consumers, the following problem is very ipmortant and in my opinion heavily under-prioritised. There are a lot of conversation regarding this issue. In the following one @MikeJolley (owner of the wocommerce github repository) was also involved(github.com issues/4131) and linked to the site - How Taxes Work in WooCommerce where you can find the following filter to remain the prices constant regardless of the tax rate

add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' )

By using the filter you can achieve the following:

Example 1: Selling from GB (with their 20% tax rate) to Germany. The price of the product is 9.99 including tax. GB based sellers do not need to charge tax for physical goods in Germany.

Price = 9.99 (the same) Tax = 0 (no tax is charged The German would pay 9.99 for the product, the same as GB people.

Example 2: Let's take the same above example, but consider a digital good where tax would apply of the rate 19%.

Price = 9.99 (the same) Tax = 9.99 / 1.19 = 8.39 (slightly less than GB) The German would again pay 9.99

The Problem:

For a few weeks i put the filter in my functions.php and solved the isse, unfortunately after the last Woocommerce update the mentioned filter triggers the following post call - wich executes in a infinite loop - again and again (see firebug network tab).

https://testsite.com/online-shop/?wc-ajax=get_refreshed_fragments

enter image description here

My request

Any idea how to solve this Problem - or any other way to remain the prices constant? Im not interested in heavy or paid Plugin solution wich slow down my site. Thank you so much

EDIT:

After some research i came across with the following:

Refresh fragments infinite loop #10940 and Fix for #10940 - wc_cart_hash It seems there is woocommerce bug wich is still not resolved entirely. I closed my other windows and the problem is gone. What a waste of time...

1
I just try the filter woocommerce_adjust_non_base_location_prices and I don't have seen the problem. this can come from the theme, which one do you use ?mmm
@mmm - i found the problem, please look at my edit. thxevavienna

1 Answers

0
votes

After some research i found the problem. It is a woocommerce core problem - look at Refresh fragments infinite loop #10940 and Fix for #10940 - wc_cart_hash

wc_cart_hash was used as a key for localStorage for all WooCommerce sites. If you were to load your cart for two different sites in the same browser, the two WooCommerce pages would contend over this key and loop on trying to set this key in the localStorage

This commit prepends the site's ajax URL onto the wc_cart_hash key name in localStorage, providing a unique key for each WooCommerce site. This ends contention over the keys.

It seems the woocommerce bug is not resolved entirely...

I closed my other windows and the problem is gone. Hope this helps others with the same problem.

UPDATE:

The problem also happens if you open a new Tab where you view a live preview (under Appearance - Themes) of another woocommerce theme in the backend... In my case i checked a few changes of a earlier theme.