Incorrect display of foreign currency prices
-
Hello,
I’m taking the liberty of contacting you today, as I’ve been experiencing a problem for several weeks on a customer’s site (https://www.maison-alcee.com/).
This site uses several extensions, including WooCommerce Multilingual & Multicurrency with WPML and NitroPack. The aim is to display, for example, the price of the Persée Azur (https://www.maison-alcee.com/produit/persee/#azur) at €7,500 before tax for users in France, and at $8,900 before tax for users in the United States.The problem is as follows:
When my VPN is deactivated and I’m in France, the price is displayed correctly in euros.
However, when I activate the VPN to simulate a connection from the USA, the amount is sometimes displayed correctly ($8,900 excluding taxes), but most of the time it remains displayed in euros (€7,500 excluding taxes).I found a solution here: https://wpml.org/forums/topic/nitropack-and-multi-currency/
So I added the following code to the functions.php file of my WordPress theme:function wcml_set_custom_currency_cookie( $currency = false ) {
if ( is_admin() && !( defined('DOING_AJAX') && DOING_AJAX ) )
return;
if ( !empty( $currency ) ) {
setcookie('wcml_custom_currency_cookie', $currency, time() + 60*60*24*7, '/');
return;
}
if ( empty( $_COOKIE['wcml_custom_currency_cookie'] ) && function_exists( 'get_woocommerce_currency' ) ) {
setcookie('wcml_custom_currency_cookie', get_woocommerce_currency(), time() + 60*60*24*7, '/');
}
}
add_action('wcml_switch_currency', 'wcml_set_custom_currency_cookie');
add_action('init', 'wcml_set_custom_currency_cookie');I’ve also added wcml_custom_currency_cookie (https://ibb.co/vV9Zvkk) to the NitroPack settings (Cache Settings > Cache).
Unfortunately, the problem persists.For the record, I’m using a VPN for my tests.
Would you have any suggestions or avenues to explore to solve this problem?
Thanks in advance,
Lo?c V.The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.