Woocommerce and redis cache method

Today I’ve been migrating some sites to the Redis cache option with brilliant results. I would like to migrate my Woocommerce sites as well. Is there any special configuration needed when using Redis with Woocommerce?

Hello @zamson

Is there any special configuration needed when using Redis with Woocommerce?

Yes, you may require to add extra configuration .

On some site, they has some woocommerce add-to-cart/session related issue with redis object-cache.

You may need to add following lines on /var/www/example.com/conf/nginx/woo-nginx.conf

  	if ( $cookie_woocommerce_items_in_cart = "1" ){
    
    		 set $skip_cache 1;

    	}
  

    	# Don't cache uris containing the following segments

    
    	if ($request_uri ~* "(/shop.*|/cart.*|/my-account.*|/checkout.*|/addons.*|/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {

    		set $skip_cache 1;
  
    	}   

Refer https://gist.github.com/rahul286/dc64ae84c97868b862c4 .

Also please refer this

1 Like

@Prabuddha Thanks for this thorough answer!

Hello @zamson

I hope your query is resolved. I am closing this support topic for now.

Feel free to create a new support topic if you have any queries further. :slight_smile: