"/cart.js" endpoint returning cached data instead of live cart

Short description of issue

/cart.js endpoint returning initial response with browser cache max-age 4 hours causing the cart to be displayed as empty even after an item is added to the cart.

Reproduction steps

I am not able to reproduce it consistently, but it has been happening for a few days at least now across multiple stores.

An example is this request ID: 2fa61c9c-358e-4f63-91cf-1c1db38c26ad-1758447714

Additional info

I’m experiencing an issue where the /cart.js Cart API endpoint is returning cached/stale cart data instead of the current cart state. This appears to be related to browser caching when the cache-control headers aren’t properly set.

Request ID: 2fa61c9c-358e-4f63-91cf-1c1db38c26ad-1758447714
Timestamp: Sun, 21 Sep 2025 09:41:54 GMT
Shop ID: 89208979786

Problem:
The request returned 200 OK (from disk cache) with cache-control: max-age=14400 (4 hours), causing stale cart data to be served. The same endpoint only returns fresh data when cache-busting parameters are added (?t=timestamp).
Expected Behavior:
Cart API endpoints should return fresh data with appropriate no-cache headers, as cart contents are session-specific and highly dynamic.

Request Headers Analysis:
cache-control: max-age=14400
cf-cache-status: MISS
x-cartjs-updatedat: 1758447714
Status: 200 OK (from disk cache)

This could be a CloudFlare config issue, where you have the Browser Cache TTL set to 4 hours.

What type of topic is this

Bug report

1 Like