|
/ Knowledge Base /Troubleshooting/ Configuring LiteSpeed Cache for SureCart

Configuring LiteSpeed Cache for SureCart

SureCart uses WordPress REST API endpoints and core scripts to deliver real-time cart data, customer information, product details, and checkout flows. Improper caching configuration can cause outdated information, broken checkout forms, or missing cart updates. The following settings ensure LiteSpeed Cache does not interfere with SureCart’s dynamic features.

Requirements

  • LiteSpeed Cache plugin installed and activated
  • SureCart plugin installed and activated

Step 1: Exclude REST API Requests from Caching

SureCart relies on WordPress REST API endpoints (URLs starting with /wp-json/) to function correctly. Caching these endpoints can result in outdated or broken information.

Go to WordPress Dashboard → LiteSpeed Cache → Cache → Excludes.

Under Do Not Cache URIs, add the following:

/wp-json/*

Click Save Changes.

This ensures all REST API requests are served fresh and never from cache.

Step 2: Prevent Deferring of Core WordPress Scripts

SureCart depends on core WordPress scripts (wp-api-fetch, wp-a11y, wp-i18n, wp-url, dom-ready, and hooks) for dynamic operations. Deferring these scripts can break checkout forms, cart updates, and other interactive elements.

Go to WordPress Dashboard → LiteSpeed Cache → Page Optimization → JS Settings.

Option A: Disable JS Deferral Completely

Locate Load JS Deferred and switch it to Off.

Click Save Changes.

Option B: Exclude Specific Scripts from Deferral

If JS deferral must remain enabled for other scripts, leave Load JS Deferred set to On.

Go to the Tuning tab.

Under JS Excludes, add the following script paths:

/wp-includes/js/dist/api-fetch.min.js
/wp-includes/js/dist/a11y.min.js
/wp-includes/js/dist/i18n.min.js
/wp-includes/js/dist/url.min.js
/wp-includes/js/dist/dom-ready.min.js
/wp-includes/js/dist/hooks.min.js

Click Save Changes.

This ensures core WordPress scripts load synchronously and SureCart functionality remains intact.

Step 3: Disable JavaScript Combining

Combining JavaScript files can delay critical SureCart scripts and break real-time interactions, especially on servers using HTTP/2.

Go to WordPress Dashboard → LiteSpeed Cache → Page Optimization → JS Settings.

Locate Combine JS Files and switch it to Off.

Click Save Changes.

This prevents LiteSpeed from merging JavaScript files, ensuring SureCart scripts load independently.

Step 4: Exclude Dynamic SureCart Pages from Caching

SureCart pages such as Checkout, Customer Dashboard, Login, and Registration display user-specific data that must never be cached.

Go to WordPress Dashboard → LiteSpeed Cache → Cache → Excludes.

Under Do Not Cache URIs, add the following page slugs:

/checkout/
/login/
/account/
/customer-dashboard/

Note: If custom permalinks or renamed pages are being used, substitute the appropriate URLs.

Click Save Changes.

These pages will now bypass caching and display current user data.

Step 5: Disable Aggressive Browser Caching for Dynamic Content

Browser caching can cause browsers to store outdated checkout or cart pages locally. Disabling this setting ensures fresh content is always loaded.

Go to WordPress Dashboard → LiteSpeed Cache → Browser.

Locate Enable Browser Cache and switch it to Off.

Click Save Changes.

This ensures dynamic pages such as checkout and cart are always fetched fresh. Static assets like images, CSS, and JavaScript will also not be cached in the browser.

Step 6: Clear Cache and Test Changes

After applying the settings, verify that SureCart functions correctly.

Go to WordPress Dashboard → LiteSpeed Cache → Toolbox → Purge.

Click Purge All to clear the cache.

Open an incognito or private browsing window to avoid cached browser data.

Perform the following tests:

  • Visit a product page and add an item to the cart. Verify the cart updates in real time.
  • Navigate to the checkout page and confirm the form loads without errors.
  • Log in and visit the Customer Dashboard. Verify account data displays correctly.

If issues occur, such as missing cart items, JavaScript errors, or white screens:

  • Go to WordPress Dashboard → LiteSpeed Cache → Page Optimization and confirm SureCart scripts are not being deferred or combined.
  • Go to WordPress Dashboard → LiteSpeed Cache → Cache → Excludes and verify all /wp-json/* and dynamic page URIs are entered correctly.
  • Purge the cache and retest.

Expected Outcome

Once configured correctly, LiteSpeed Cache will not interfere with SureCart’s dynamic functionality. Cart updates, checkout forms, and customer dashboards will load with current data in real time.

Notes

  • These settings apply to standard SureCart page slugs. If custom permalinks have been configured, adjust the excluded URIs accordingly.
  • Disabling browser caching for all content may reduce performance for static assets. If needed, browser caching can be re-enabled with specific exclusions for dynamic SureCart pages.
  • Changes to LiteSpeed Cache settings require clearing the cache to take effect.

FAQ

What happens if I don’t exclude REST API endpoints from caching?
Customers may see outdated cart data, incorrect product information, or broken checkout flows. Dynamic data will not update in real time.

Why do core WordPress scripts need to be excluded from deferral?
SureCart depends on these scripts to handle interactive features. Deferring them can cause checkout forms, cart updates, and other dynamic elements to fail or display errors.

Can I enable JavaScript combining for other scripts while excluding SureCart dependencies?
JavaScript combining is not recommended when using SureCart, as it can delay critical scripts and cause functionality issues. It is best practice to disable combining entirely.

What should I do if my checkout page still doesn’t work after following these steps?
Verify that all excluded URIs and scripts are entered correctly in LiteSpeed Cache settings. Clear the cache completely and test in an incognito window. If issues persist, temporarily disable LiteSpeed Cache to confirm it is the source of the problem.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top