Dynamic caching for Woocommerce

Hi,

Hope you are doing well. I'm a few hairs less this evening, I've been rattling my brain trying to work out how to get dynamic caching to work for Woocommerce on my wordpress website. I have an extension of woocommerce installed which resolves the connecting IPs geographic location and presents prices in the users native currency.

Issue I am experiencing is, the first user to connect and load a page after the FastCGI cache has expired or been purged, sets the currency and price for all further users.

Here is a look at my current dynamic cache:

> \#fastcgi\_cache start
>
>set $no\_cache 0;
>
>
>
>\# POST requests and urls with a query string should always go to PHP
>
>if ($request\_method = POST) {
>
>set $no\_cache 1;
>
>}
>
>if ($query\_string != "") {
>
>set $no\_cache 1;
>
>}
>
>
>
>\# Don't cache uris containing the following segments
>
>\# Contains booster-plus exception. Find and remove incl. horizontal dash if fails.
>
>if ($request\_uri \~\* "(/wp-admin/|woocommerce.php|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.\*.php|/feed/|index.php|wp-comments-popup.php|wp-links-op$
>
>set $no\_cache 1;
>
>}
>
>
>
>\# Don't use the cache for logged in users or recent commenters
>
>if ($http\_cookie \~\* "comment\_author|wordpress\_\[a-f0-9\]+|wp-postpass|wordpress\_no\_cache|wordpress\_logged\_in") {
>
>set $no\_cache 1;
>
>}

As you can see in the if request\_uri logic, I have defined woocommerce.php. I have tried placing /booster-plus-for-woocommerce/\* there also to try stop the caching occurring for that plugin only.

Does anyone know how I can isolate this plugin and prevent caching of it - to ensure the native currency of the user is shown.

Thank you 🙂

1 thought on “Dynamic caching for Woocommerce”

  1. If you want to cache the same currency for the same user , you will have to cache each version of each currency and showing the appropriated.

    caching cannot runs php request

    If so, let me know how to.

    Reply

Leave a Comment