If you use the WordPress Cache Plugin creating buffer (cache) to speed WP Super Cache website as, W3 Total Cache, Zen Cache, WP-FFPC, ….. you maybe encountered a problem as it is the shopping cart page, payment … will be cached so customers had difficulty in using. So better, we add a list of special pages on the list which are not cached in the plugins. If you still do not know how to use, then this tutorial will help you.
For WP Super Cache
If you are using WP Super Cache in WordPress Cache Plugin then you go to Settings -> WP Super Cache -> Advanced and find to share as photos below and enter the slug name of page which should eliminate cached on.
For W3 Total Cache
You on Performance -> Page Cache and navigate to the “Never cache the following pages’ and then enter the path of the page to remove cached on.
For Zen Cache
You find to item URI Exclusion Patterns and declaring.
For WP-FFPC
You go to Cache exceptions and fill in the “Do not cache sau URL paths – use with caution!”.
For servers using EasyEngine
If you are using EasyEngine in WordPress Cache Plugin, it might need to edit the cache configuration file you are using. For example, you use a set –wpfc then go to the directory / etc / nginx / common files and find wpfc.conf and wpfc-hhvm.conf then add the following to the above location / {.
01 02 03 04 05 06 07 08 09 10 11 12 13 14 | # Skip cache on WooCommerce pages if ($request_uri ~* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*") { set $skip_cache 1; } # Skip cache for WooCommerce query string if ( $arg_add-to-cart != "" ) { set $skip_cache 1; } # Skip cache when WooCommerce cart is not empty if ( $cookie_woocommerce_items_in_cart != "0" ) { set $skip_cache 1; } |
If you have inserted properly, it will look like this:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | # set $skip_cache 0; # POST requests and URL with a query string should always go to php if ($request_method = POST) { set $skip_cache 1; } if ($query_string != "") { set $skip_cache 1; } # Don't cache URL containing the following segments if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap$ set $skip_cache 1; } # Don't use the cache for logged in users or recent commenter if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_n$ set $skip_cache 1; } # Skip cache on WooCommerce pages if ($request_uri ~* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*") { set $skip_cache 1; } # Skip cache for WooCommerce query string if ( $arg_add-to-cart != "" ) { set $skip_cache 1; } # Skip cache when WooCommerce cart is not empty if ( $cookie_woocommerce_items_in_cart != "0" ) { set $skip_cache 1; } # Use cached or actual file if they exists, Otherwise pass request to WordPress location / { try_files $uri $uri/ /index.php?$args; } location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$$ } location ~ \.php$ { set $rt_session ""; if ($http_cookie ~* "wc_session_cookie_[^=]*=([^%]+)%7C") { set $rt_session wc_session_cookie_$1; } if ($skip_cache = 0 ) { more_clear_headers "Set-Cookie*"; set $rt_session ""; } fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session"; try_files $uri =404; include fastcgi_params; fastcgi_pass php; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; } location ~ /purge(/.*) { fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; } |
Then remember to restart NGINX.
01 | sudo service nginx restart |
Above is a WordPress Cache Plugin popular to good use with WooCommerce. Wish you success!
Thanks for your reading. If you have any question with this blog, don’t hesitate to leave a comment.