Bypass cache when add to cart ?

Xavier Cardil Coll info at
Wed Dec 23 12:39:20 CET 2015

On Nginx cache, you can do this to avoid keep on caching when you add
something to the cart in Woocommerce :

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;

How can you do this in Varnish ? With this config, wich was made
specifically for Wordpress + Woocommerce, when you add something to cart,
cache is not disable store wide so you get a mix of cached and non cache
pages, cart gets emptied :


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list