Manage Cache

Index

How cache works on WooCart

WooCart cache is built for each country and each browser separately. This is to correctly serve multi-language and multi-currency stores without issues. The first load for the country or browser is slower, but every next load is served from the cache. The cache is flushed every hour.

When you are testing on the mywoocart.com subdomain, your store might feel slow if you're the first visitor for the country or browser. When the store is live, this is not an issue since the cache is quickly built by live visitors.

Cache Plugin

The cache plugin is Redis Object Cache which is installed and activated by default. We do not recommend installing other cache plugins.

Clearing Site Cache

Click Flush Cache in WordPress navbar on top.

If you can't access the dashboard, you can go to WP-CLI and click Restart PHP Workers. 
If you want to prevent page cache to be used, you can add either skip_cache=1 as a cookie or as a request parameter. In that case, the responses are no longer cached and will contain X-Cache-Status: BYPASS header.

Clearing Image/CSS CDN Cache

If you changed images or your CSS is not refreshing with regular Flush Cache, you need to Flush CDN Cache as well. Go to Addons > CDN and click the link. Clearing CDN cache can take up to 10 minutes.

Caching Custom Parameters

Tracking parameters in the URL like utm_content, Facebook's fbclid, or Google' gclid bypass cache on regular server configurations. This means that instead of serving the page from cache, a PHP worker is required for every visit. This can cause performance issues if you're running a large FB campaign (or any campaign with tracking parameters).

WooCart does custom caching and serves pages from the cache even if they're loaded with these URL parameters. If you have your own parameters, you'll need to add them on your own.

Add your own custom parameters

Create or upload a file to wp-content named .nginx-querysting_filter.

Add the default tracking parameters:

sorted_querysting_filter_parameter fbclid gclid utm_source utm_medium utm_campaign utm_id utm_content;

To add your own parameter, add it before the ;. If you have more than one, separate them with a space.

Go to WP-CLI and restart PHP workers to apply the changes.

Testing the implementation

To test you can use the command  curl under the WP-CLI tab.

For example:

$ ▶ curl -I "https://woostoredemo.com/?utm_content=1"

The response:

HTTP/2 200 
date: Mon, 24 May 2021 08:45:50 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
link: <https://woostoredemo.com/wp-json/>; rel="https://api.w.org/"
link: <https://woostoredemo.com/wp-json/wp/v2/pages/19>; rel="alternate"; type="application/json"
link: <https://woostoredemo.com/>; rel=shortlink
x-cache-key: cache:Slovenia::42099b4af021e53fd8fd4e056c2568d7c2e3ffa8:https:HEAD:woostoredemo.com
x-cache: MISS
x-cache-skip-reason: 000000
x-cache-skip: 0
x-page-speed: WooCart
cache-control: max-age=0, no-cache
strict-transport-security: max-age=15724800; includeSubDomains

We then do another request where we change the parameter value:

$ ▶ curl -I "https://woostoredemo.com/?utm_content=2"

The response x-cache should now be HIT. This means that the cached version of the page was served and ignored the changed UTM parameter.

Skipping the cache

If you want to temporarily disable cache for a specific page you can do that by:

a) Adding random query string to the URL ("checkout?random")

b) Adding a "skip_cache=1" cookie for a specific path or domain

c) Adding nginx rule to the wp-content/.nginx-server and restarting the workers

 location ~ /my-path/ {
   	set $skip_cache 1;
}

Clearing WPML Cache

After publishing staging you need to clear WPML cache with the below WP-CLI command:

wp option delete wpml_language_switcher_template_objects
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us