• Resolved orion1212

    (@orion1212)


    Hi,

    I’m currently using the WooCommerce payment multi-currency switcher in conjunction with W3 Total Cache. However, it’s evident that caching and multi-currency functionality don’t integrate seamlessly. Following cache purges, the first cached page tends to be served to all users, which is to be expected.

    To address this issue, I want to implement page fragment caching and exclude the price and currency functions from caching by wrapping them under the <mfunc>, as demonstrated here: Link to GitHub Page.

    My question is, which PHP code, part of the plugin should I wrap with this function to make it work effectively? I of course have a child theme and the WooCommerce Payments plugin files ready for copying.

    Thank you for your assistance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @orion1212

    The PHP code you need to wrap with the function would be the code that handles the display of prices and the currency switcher. This is typically found in the functions.php file of your WooCommerce Payments plugin.

    However, please note that altering the plugin’s code directly can lead to issues when updating the plugin in the future. It’s recommended to use hooks and filters provided by the plugin instead, if available.

    You should also consider reaching out to the developers of the W3 Total Cache and WooCommerce Multi-Currency plugins for their advice. They may have specific recommendations or best practices for their plugins.

    If you have any other questions, feel free to ask. We’re here to help!

    Thread Starter orion1212

    (@orion1212)

    Hi @shameemreza ,

    Thank you for your answer. W3TC has been contacted earlier and figured out that only page fragment caching would work to obtain caching + currencies. I am just looking for the location of the code I need to wrap.

    I am not using an external plugin to handle the currencies, only WooCommerce and WooCommerce Payments are used. Would you know which hook or filter I should wrap the mfunc on?

    Hi there @orion1212 ??

    Thank you for reaching back, elaborating further on this.

    From what I gather, the team at W3 Total Cache are working on some more elegant solutions, which will include a couple of one-click WooCommerce options. They’d be in a better position to advise on an ETA for this.

    Meanwhile, I’ll go ahead with linking to the official WooCommerce document for configuring caching plugins.

    I trust that points you in the right direction, but if you have more questions, let us know.

    We’re happy to help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Implementing Page Fragment Cache for currencies’ is closed to new replies.