Cart pattern · 2026
The bag is the checkout.
A cart drawer built to the current best practice: a tiered reward ladder, inline variant edits, optimistic quantity updates that roll back when the server says no, remove-with-undo, save for later, and honest totals before you ever hit checkout.
What's under the hood
- Reward ladder. Two live tiers — free shipping, then a free gift — with a bar that fills as you spend and announces each unlock.
- Optimistic + rollback. Quantity changes apply instantly, batch after 300 ms, then reconcile with a fake server. Push past stock and the line rolls back with a reason.
- Undo, not "are you sure". Removal is one tap, reversible for six seconds.
- Real totals. Subtotal, promo, estimated tax, shipping and a dated delivery estimate — no surprises at checkout.
- Persistent. The bag survives reloads and syncs live between tabs.
- Accessible. Focus trap, focus restore,
Escto close, inert background, live-region announcements, full keyboard operation, reduced-motion path.