Troubleshooting WooCommerce Sale Price Caching Issue on Single Product Pages

In a recent Business Bloomer Club discussion, a WooCommerce developer raised an issue where a client’s expired sale prices were still visible to logged-out users on single product pages.

This unusual behavior didn’t affect cart prices but created confusion on the product page.

Although server-side caching appears to be the main culprit, many WooCommerce users are unfamiliar with managing caching strategies for dynamic content like sales pricing.

WooCommerce product pages often display time-sensitive information, such as sale prices, which updates dynamically. Most cache plugins designed for WooCommerce will bypass product pages to avoid issues. However, server-side caching may not automatically account for this dynamic content, leading to expired sale prices being “stuck” in the cache and visible to users until the cache is purged.

Suggested Solutions to Resolve Display Issues

1. Exclude Product Pages from Server-Side Caching

To address this, excluding product pages from caching is a logical first step. Disabling server-side caching specifically for single product pages ensures that logged-out users see accurate prices. Many caching solutions, such as Varnish or NGINX, allow for conditional exclusions, so advising the client’s hosting provider to exclude these pages could be an effective solution.

2. Implement Cache-Control Headers

An alternative approach is using cache-control headers to instruct browsers and servers not to cache product pages. This can be particularly helpful if server-side caching is necessary for overall site performance. Setting shorter expiration headers for product pages ensures they refresh more frequently.

3. Manual Cache Purges After Price Changes

If excluding pages or adjusting cache controls isn’t viable, consider recommending manual cache purges when sale prices change. While less convenient, this ensures up-to-date pricing on key pages and allows caching to remain active elsewhere on the site.

Conclusion

Dynamic pricing in WooCommerce adds a layer of complexity to server-side caching. For store owners facing similar challenges, excluding product pages from server-side caching or setting shorter cache durations are the most practical options. By managing caching policies strategically, WooCommerce stores can maintain performance while ensuring customers see accurate and timely pricing details.

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Reply

Your email address will not be published. Required fields are marked *