Markland Hill Get in touch
Devlog

Nothing cart-derived is ever cached

· Bakehouse Collect

Two endpoints in this app describe what is in somebody’s basket: how close they are to the next quantity break, and whether a suggestion applies. Both send no-store, and that is not caution.

Their answers depend on the shopper’s cart, which changes constantly. A cached answer names a quantity they no longer hold — “add one more” to somebody who has just emptied their basket, or a price for four when there are two.

We know because the offer endpoint did cache, for a minute, from back when its line only described a product rather than a basket. That is exactly how it went wrong: the feature grew from “this product has a discount” into “your basket is two away from it”, and the caching that was harmless for the first is incorrect for the second. Nobody moved the cache header, because nobody was thinking about the cache header.

The plugins also refresh on any click inside a cart-ish element, not only on Add to Cart. The platform’s cart-change event does not reach them on every storefront, adding has confirmed hooks but removing does not, and over-refreshing costs one request where missing a change costs a wrong price on screen.

That asymmetry is the whole decision. An unnecessary request is a few milliseconds. A stale offer line is a shop advertising a price its own checkout will not honour.

← All posts