问题
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