dongquweng5152 2017-12-26 20:55
浏览 85
已采纳

无论税率如何,都保持不变的Woocommerce价格 - B2C

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条回答 默认 最新

  • dsizmmwnm56437180 2017-12-26 22:39
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器