Skip Navigation

Resolved

Resolved in: 4.11.0

Overview of the issue

If you use a caching plugin on a WooCommerce site that uses the WCML multi-currency feature, your customers may see incorrect prices or not be able to change currencies.

Workaround

We are working with popular caching plugins to improve compatibility. In the meantime, we recommend that you exclude pages from cache that use browser cookies and multi-currency.

6 Responses to “Caching plugins may cause issues with WCML multi-currency settings”

  1. Seems on product pages that multi-currency does not seem to work properly as prices in USD for USD customers are not the same as for EU / EUR customers. This is especially the case with shipping fees. We are using WP Rocket and we would prefer not to exclude the currency converted on WooCommerce category or product pages. But perhaps you could have a look see what can be done and whether this really is currency converter related.

  2. all kinsta user ( nginx cache) have the same problem but this case is old …. wpml look to solve it before 2050 ??

  3. SOLUTION FROM KINSTA ( For NGINX):

    1: Add the following php code via either a code editor plugin or via the functions.php file somewhere or in child theme’s functions.php file. This will create the “wcml_custom_currency_cookie” cookie:
    
    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’);

    
    2: Exclude cache for the $wcml_custom_currency_cookie http_cookie via nginx (Us in Support can only modify/edit these since we’re a managed hosting platform.
    
    3: Strip all $http_cookies that are still cached on cache HITS, this will avoid the cookie from being set up on pages that hit the Kinsta cache to avoid bypassing Kinsta cache where we don’t need to bypass Kinsta cache. As you know, cache on WordPress is very important to keep site speed optimized!

    –> Also only something in Kinsta Support can do via Nginx.

  4. Hi there!

    I’m experiencing two issues with WPML Multi-Currency and my support tickets remain unresolved.

    It may be due to caching plugin (SG Optimizer) but my support person hasn’t even mentioned this yet.

    My problem is, if I update the translation of a subscription product, then the translation’s prices become corrupted. If I edit the default language (I don’t even have to change anything) and just press update, then the translation’s prices are shown correct again.

    Purging cache doesn’t help.

    The other problem I have is that if I sell something in another currency than default (other than JPY) and the purchase was made with stripe, the shipping and costs on the page of the order may be written as $ for example, but the numbers are very clearly in JPY. It can say it sub total $3,000 for a $300 product (if the original price was 3000 yen).

    • Hey Miguel,
      The situation you are describing so far does not seems related to the issue here related. This errata is related to front-end prices while what you are experiencing is related to the backend.
      Please continue in your open ticket as there may be a database corruption or an incompatibility with a third party.
      Thank your for your understanding.