WP Shopping Cart and WP Super Cache

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

extradrmtech

Since 30 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions and medias protecting solutions. I am experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. Besides my work, I like to work freelance only on some wordpress projects because it is relaxing and delightful CMS for me. When not working, I like to dance salsa and swing and to have fun with my little family.

You may also like...

Leave a Reply