Back to Community

Troubleshooting Common WooCommerce Caching Issues with LiteSpeed Cache

26 threads Sep 7, 2025 PluginLitespeed cache

Content

Why WooCommerce and Caching Can Clash

WooCommerce is a dynamic, session-based e-commerce platform, while page caching works by serving static HTML copies of your pages to improve speed. This fundamental difference can lead to conflicts where user-specific elements—like the shopping cart, mini-cart, or checkout—don't behave as expected. Based on common community reports, this guide will help you diagnose and resolve the most frequent WooCommerce caching issues encountered with the LiteSpeed Cache plugin.

Most Common WooCommerce Caching Issues and Their Fixes

1. The Disappearing or Empty Mini Cart

The Problem: Products appear in the cart on one page, but the mini-cart is empty when navigating to another page, such as the homepage. This often occurs when using a Content Delivery Network (CDN) like Quic.cloud or when specific JavaScript operations are delayed.

Why It Happens: The cart state is often tied to cookies or session data. If the cached page does not vary based on these elements, it will show a generic, empty cart state to all users.

Potential Solutions:

  • Enable 'Vary for Mini Cart': Navigate to LiteSpeed Cache -> Cache -> WooCommerce and ensure the 'Vary for Mini Cart' option is turned ON. In some cases, toggling this setting off, waiting several minutes, and then turning it back on can help reset its function.
  • Check Cookie and URI Exclusions: Ensure that standard WooCommerce pages and cookies are excluded from caching. Common practices include:
    • Do Not Cache URIs: Add /cart/, /checkout/, /my-account/, and /wc-api/* to the exclusion list.
    • Do Not Cache Cookies: Exclude cookies like woocommerce_cart_hash, woocommerce_items_in_cart, and wp_woocommerce_session_.
  • Review .htaccess Rules: For advanced users, adding a rule like RewriteRule .? - [E="Cache-Vary:woocommerce_cart_hash"] to your .htaccess file can help the server vary the cache based on the cart's contents.

2. AJAX Add to Cart and Nonce Errors

The Problem: Clicking "Add to Cart" reloads the page instead of using AJAX, or you see console errors about 'nonce verification failed' or '403 Forbidden' on admin-ajax.php.

Why It Happens: WordPress nonces (security tokens) have a limited lifespan. If a page is cached with an old nonce, that token will expire, causing AJAX requests to fail. JavaScript Delay can also break scripts that rely on variables set by wp_localize_script().

Potential Solutions:

  • Disable JavaScript Delay/Defer: As a first step, try turning off JavaScript Delay. If this resolves the issue, you can then carefully add exclusions for the specific WooCommerce scripts that are breaking.
    • JS Exclusions: Try excluding scripts containing names like wc-, cart, ajax, or woocommerce. Common exclusions are cart-fragments or wc-add-to-cart.
  • Enable ESI (Edge Side Includes): ESI can help by not caching dynamic blocks like the cart. This is an advanced feature located under LiteSpeed Cache -> Cache -> ESI.
  • Check ModSecurity: A 403 error can sometimes be triggered by server-level ModSecurity rules. If you have server access, check your ModSecurity logs for blocked rules related to WooCommerce or AJAX requests. Temporarily disabling ModSecurity can help confirm if it is the cause.

3. Third-Party Plugin Conflicts (Payment Gateways, Quote Buttons, B2B)

The Problem: Features from other plugins, such as payment gateways (Stripe), 'add to quote' buttons, or dynamic B2B pricing, stop working when caching is enabled.

Why It Happens: These plugins often rely on complex AJAX calls, POST data, or user-specific sessions that are incompatible with full-page caching.

Potential Solutions:

  • URI Exclusion is Key: The most reliable fix is to completely exclude the pages where these features are used from being cached. Add the specific URLs to the Do Not Cache URIs list.
  • Consider ESI for Specific Elements: For dynamic elements like prices on product pages, ESI can be a powerful solution. However, implementing it requires custom development to wrap the dynamic content in ESI blocks, which may be beyond a standard user's setup.
  • Identify Conflicting Settings: Use the Report tool in the plugin's Toolbox to generate a report number. This can help the community or your host identify conflicting settings with other optimization layers (e.g., host-level caching or CDN).

4. Layout and Display Issues

The Problem: Product images don't load, product options are missing from dropdowns, or large empty spaces appear on product pages for logged-out users.

Why It Happens: CSS/JS optimization (Combine, Minify, Defer, Delay) can sometimes break the execution order or loading of scripts and styles that are necessary for the page to render correctly.

Potential Solutions:

  • Disable Optimization Settings: Temporarily turn off all CSS/JS optimization settings (Combine, Minify, Defer, Delay). If the problem is resolved, re-enable them one by one to identify the culprit.
  • Add Specific Exclusions: Once you identify the problematic setting, you may need to add specific CSS or JS file paths to the exclusion lists for that feature.
  • Compare Source Code: To see exactly what the optimization is changing, compare the HTML source of a page with the plugin enabled versus disabled using a tool like Diffchecker.

General Troubleshooting Steps for Any Issue

  1. Isolate the Problem: The first step is always to confirm LiteSpeed Cache is the cause. Temporarily disable the plugin. If the problem disappears, you know the issue is related to caching.
  2. Generate a Report: Navigate to LiteSpeed Cache -> Toolbox -> Report. Click "Send to LiteSpeed" to generate a unique report number. This number is essential for getting targeted help, as it contains your site's configuration.
  3. Start with a Default Configuration: Reset LiteSpeed Cache settings to default (Toolbox -> Import/Export -> Reset Settings). This can quickly rule out problems caused by a misconfigured setting. Then, only enable the basic page cache and test.
  4. Check for Conflicts: Rule out conflicts with other plugins or your theme by disabling all other plugins and switching to a default theme (like Storefront). If the issue is resolved, re-enable them one by one to find the conflict.
  5. Purge All Cache: After making any configuration change, always purge all caches (from the admin bar) and test in a fresh incognito browser window to ensure you are not seeing a stale cached version.

Disclaimer: BugWP.com is an independent resource and is not affiliated with LiteSpeed Cache. All information is provided based on community experience and may not be applicable to every setup.

Related Support Threads Support