Proper Varnish settings for Woocommerce WordPress site running on Cloudways

Cloudways’ Varnish cache is sometimes a little too “sticky” for hers, especially under the Woocommerce environment without the correct exclusions. Most of us who are using Cloudways as our hosting service (CPG Cloudways Guide) will certainly come across a handful of annoying issues that could turn a sale away; such as the top right icon cart count doesn’t update when adding or removing an item, persistent empty cart, users unable to login or check out, shipping cost does not calculate, etc…

To fix those problems, carefully apply these rules for your Varnish cache from Cloudways platform panel. Be sure you already have Varnish enabled and properly configured for WordPress (Varnish setting for W3TC).

1. Exclusion Rules for Woocommerce

Application Settings > Varnish Settings > Add New Rules

Type

Method

Value

URL Exclude \?add-to-cart=
URL Exclude ^/(cart|my-account/*|checkout|wc-api/*|addons|logout|lost-password|product/*|wp-admin|wp-login)
Cookie Exclude woocommerce_cart_hash
Cookie Exclude woocommerce_items_in_cart
Cookie Exclude wp_woocommerce_session_

Sample:



2. Optional Rules for WordPress

Type

Method

Value

Cookie Exclude wp-settings-\d+=[^;]+(; )?
Cookie Exclude wp-settings-time-\d+=[^;]+(; )?
Cookie Exclude wordpress_test_cookie=[^;]+(; )?
Cookie Exclude wordpress_logged_in

Send and Receive Emails using Your Domain without an Email Server (Cloudways/Vultr/Runcloud/ServerPilot).

Today Deals!

*These special sales are shared by Glitch Deals Hero, our sister site from another neanderthal great grandfather twice removed.

Leave a Comment.

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


2 Comments
  1. December 26, 2017
    • December 29, 2017