WP Shopping Cart and WP Super Cache Workaround
Categories: Additional Guidance
If you are using the WP Super Cache plugin on your WordPress blog together with some WordPress Shopping Cart plugin (eg. Simple WordPress PayPal Shopping Cart) then there is a good chance that you are experiencing some funny behavior (eg. the shopping cart doesn’t show the products after item addition) with your shopping cart plugin.
The Problem
The reason behind this is that the WP Super Cache is a static caching plugin. It generates HTML files that are served directly by Apache without processing PHP scripts. So when a visitor on your blog adds a product to the shopping cart and is wondering why it’s not being displayed in the basket is probably because he/she is still loading the static HTML (cached) file of that page.
The Workaround
You basically need to tell the WP Super Cache plugin to not cache certain pages (pages where you are displaying the shopping cart eg. checkout page).
Super Cache allows you to specify a string that forces a page not to be cached. For example, if your URLs include year and you do not want to cache last year posts, it’s enough to specify the year, i.e. ‘/2008/’. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.
So in your case you can use a unique string like ‘wp-shopping’ (eg. www.your-domain.com/your-page-title-wp-shopping) in the URL of the pages where you have the shopping cart displayed so those pages are not cached. Then enter that string (wp-shopping) in the Rejected URIs field of the WP Super Cache settings.

If you are displaying the Category in the URL then you can create a special category called ‘NoCaching’ and add the posts/pages (that you do not want Super Cache to cache) to that category. This way your URL will look similar to the following:
www.your-domain.com/NoCaching/checkout-page
www.your-domain.com/NoCaching/all-products-page
Feel free to leave a comment if you are having any issues with this workaround.
Visit the WP Shopping Cart plugin page.









July 30th, 2009 at 7:16 pm
what if your shopping cart is in the sidebar widget? Is there a workaround for that?
July 31st, 2009 at 1:44 am
LOL.. I don’t have a workaround for that. Sometimes you gotta sacrifice something to get something
It’s just how caching works.. if a page is cached then you can’t expect dynamic behaviour (eg. when your customer clicks the add to cart button) from PHP. I am thinking of creating a Javascript version of the shopping cart later which might solve this problem though.
January 20th, 2010 at 1:04 pm
I’m ready to set up wp-super-cache for my site. Any recommendations except for those provided on this thread?
Thanks,
Esteve
January 20th, 2010 at 2:36 pm
One more comment, could be wp-super-cache or any other plugin that offers the same functionality.
September 15th, 2010 at 8:57 pm
Could you do it so that it didn’t cache the file the calls on the Sidebar?
September 16th, 2010 at 8:03 am
Hey Mindi, That’s something the caching plugin will have to do. The eStore plugin is not doing the caching so it doesn’t have any authority over what will and will not be cached.
If you are still using the wp super cache then you seriously gotta dump it and start using w3 total cache and read these posts
http://www.tipsandtricks-hq.com/forum/topic/using-the-plugins-with-w3-total-cache-plugin
http://www.tipsandtricks-hq.com/plugins-to-speed-up-your-wordpress-site-2303
September 16th, 2010 at 3:07 pm
Don’t worry..I’m not using it.. I was just revisiting the idea of it and saw your post.. I will check out W3 total cache. Thanks for the tips
Thanks
Mindi