Skip to content

LiteSpeed Cache configuration for WooCommerce on cPanel

The WooCommerce-specific LiteSpeed Cache settings that actually matter — what to cache, what never to cache, and how to verify the cart and checkout stay personalized.

WooCommerce and a page cache have a tense relationship. The product catalog wants to be cached aggressively. The cart, checkout, and account pages must never be cached. The mini-cart widget in the header changes per-user, on every page. LiteSpeed Cache handles all of this if you configure it correctly. If you don’t, the symptom is customers seeing each other’s carts, which is exactly as bad as it sounds.

What’s happening

LiteSpeed Cache ships with built-in WooCommerce awareness — it knows about the woocommerce_cart_hash, woocommerce_items_in_cart, and the session cookies WooCommerce sets. The plugin excludes cart-bearing URLs from the public cache and serves an ESI block (or a small JS fragment) for the mini-cart. Most of the configuration is already right out of the box; the failures we see are people enabling cache for logged-in users or aggressively combining JS in a way that breaks the AJAX add-to-cart.

How to verify

wp plugin list --name=woocommerce --status=active
wp plugin list --name=litespeed-cache --status=active
curl -I https://example.com/shop/ | grep -i 'x-litespeed'
curl -I -b 'woocommerce_cart_hash=abc' https://example.com/shop/ | grep -i 'x-litespeed'

The first request should hit cache (X-LiteSpeed-Cache: hit after warmup). The second, carrying the cart-hash cookie, should bypass cache (miss or no cache header). If both hit cache, you have a serious cart-bleed risk.

The fix

  1. Confirm Woo integration is on: Cache > Cache > Cache Commenters off, Cache Logged-in Users off. Toolbox > Heartbeat > leave defaults; reducing heartbeat too aggressively breaks the cart auto-save.

  2. Cache > Excludes should have, at minimum, these URI patterns:

    /cart
    /checkout
    /my-account
    /shop/?add-to-cart

    And these cookies (any of which should bust cache when present):

    woocommerce_items_in_cart
    woocommerce_cart_hash
    wp_woocommerce_session_
  3. ESI > ESI Settings: Enable ESI on. This lets the plugin cache the surrounding page while still serving a per-user mini-cart fragment. Confirm the WooCommerce mini-cart widget is the standard woocommerce_widget_cart — custom mini-cart widgets need explicit ESI registration.

  4. Cache > Object: enable object cache with Redis (preferred) or Memcached. Woo’s session and cart state benefit enormously from object cache. With LiteSpeed Memcached or a separate Redis instance, this is the single biggest performance bump after page cache.

  5. Page Optimization > JS Settings: do not enable JS Combine on a Woo site. Cart fragments use jQuery’s AJAX in a way that breaks when scripts are combined. Defer is fine; Combine is not.

  6. Image Optimization: turn on but exclude product image variations from auto-replacement until you’ve tested. Theme product galleries sometimes lazy-load images in a way that conflicts with WebP replacement.

  7. Configure cron carefully. Woo’s Action Scheduler runs many of the periodic jobs (order status transitions, low stock notifications). If you’ve disabled WP-Cron (recommended), the cPanel cron entry needs to fire at least every 5 minutes; under heavy order load, every minute.

  8. Smoke test with a real flow. Open a private window. Add a product to cart. Confirm the mini-cart updates without a page reload. Refresh the cart page. Refresh in another tab in the same session. Open a third private window (no cart) — confirm that window sees an empty cart. If anyone else’s cart ever leaks, stop and audit excludes immediately.

For Woo sites with non-trivial traffic, Stack Harbor maintains the cache profile and the verification suite as part of managed enterprise WordPress hosting.