Display product prices in the local currency with a shortcode by product ID in WPML WooCommerce Multilingual

妖精的绣舞 提交于 2021-02-11 12:41:31

问题


I've modified this custom code to to display products with a shortcode to create my own version which also changes the currency depending on the page language. For example:

  • If the page is in English, the prices are displayed in British Pounds.
  • If the page is in Spanish, the prices are displayed in EURO.

Last week WPML updated their WooCommerce Multilingual plugin to enable currency depending on user location. This is what I need! For example:

  • If the user is in United States, the prices are displayed in US Dollars
  • If the user is in United Kingdom, the prices are displayed in British Pounds.
  • If the user is in Spain, the prices are displayed in EURO.

However, I've asked the WPML support to know what function I have to call to get the local currency. Their answer was: I understand, but we do not have that publicly available.

So I'm stuck!

Anybody knows that function and how to call it??

Any other idea to show prices depending on the location of the user?

My best idea is to duplicate the English page (en) and create an exact English version for US (en-US). But I want to avoid that idea because so many duplicated pages are hard to maintain :)

来源:https://stackoverflow.com/questions/63418399/display-product-prices-in-the-local-currency-with-a-shortcode-by-product-id-in-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!