Preventing empty cart messages with Varnish

If you are experiencing empty shopping carts when using a Varnish caching server with your Easy Digital Downloads store, you might try and use the following rules to help prevent this:

In your Varnish Configuration

// Tells Varnish to pass through on the checkout page
if (req.url ~ "checkout") { return (pass); }

// Tells Varnish to pass through on any request with edd_action in the query string
if (req.url ~ "edd_action") { return (pass); }

// Tells Varnish to pass through on any request with add_to_cart in the query string
if (req.url ~ "add_to_cart") { return (pass); }

// Tells Varnish to pass through if any cookies with `edd` are found
if (req.http.cookie ~ "(^|;\s*)edd") { return (pass); }

In your wp-config.php

Put the following right above the line that states /* That's all, stop editing! Happy blogging. */

define( 'EDD_USE_PHP_SESSIONS', false );

View our full document on troubleshooting Empty Shopping Cart errors.