"Not the ID I Thought It Was"
The cart update bug from last week turned out to be two separate, smaller bugs, and clearing them out opened up the rest of the week.
Week of August 3, 2026
Progress
- Error handling added for cart updates — catches an invalid/unaccepted cart and an unavailable service
- Error handling extended to loading the cart and the store, including the header's cart-count badge
- Error handling rolled out across the remaining store calls
- Cart updates fixed and confirmed working, along with item deletion
- Add-to-cart wired up and working on the store page
- Noted that laBoutique needs its own Grafana setup — it's held up well as a service I haven't written a line of code for
The Hard Part
Error handling came first — for cart updates, then for loading the cart and store, since the same gap existed there too. Wiring up the badge load in index.php was the first thing to break under it, failing to actually surface the error it was supposed to catch. Getting that in place made it obvious how much error handling the rest of the codebase is still missing, not just the store.
Once that was in, the cart update itself turned out to be broken in two small, specific ways: each cart item needed its price_id sent explicitly, and I'd been sending the cart item's own ID where laBoutique expected the product ID. Fixing both got updates working — an actual "yahoo" out loud moment — and confirmed deletion was already fine.
Building add-to-cart on the store page raised a design question I didn't fully resolve. The cart page builds its snapshot by pulling values out of the DOM. For the store page's add-to-cart, I decided to parameterize the item-building function instead of reading the DOM inside it. I asked Claude whether the cart page's function should be refactored to match, and it said no — but the reasoning wasn't clear to me. The two cases look nearly identical apart from one looping over every cart item and the other handling a single one. Left the cart page as-is for now. Also nagging at me this week: how much I still lean on copy-and-paste, not because it's faster, but because I'm not yet fluent in some of these conventions.
Decision Made
Parameterize the store page's cart-item-building function rather than reading values from the DOM. Keeps the function's inputs explicit instead of implicit in page structure — the cart page's DOM-based version stays as it is for now, on Claude's recommendation, even without a clear enough reason to explain the split.
Learnings
laBoutique's cart update wants an explicit price_id on every line item, not just a product identifier — and it's specifically the product ID it wants there, not the cart item's own ID. Easy to conflate the two once both are floating around in the same payload.
The Question That Appeared
Add-to-cart works now, but what should happen right after — jump straight to the cart, or just confirm the item was added and let shopping continue? Still undecided.
Next Week
Update the cart badge after a successful add — increment it directly or reload the cart data — then settle the add-to-cart navigation question above.
