Fix cart badge to include calendar entries in count
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 55s

Context processor now sums product count + calendar_count from the
cart API, so the cart badge shows the correct total on all pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-18 21:49:42 +00:00
parent c537770172
commit 2efc05957e
2 changed files with 4 additions and 4 deletions

6
app.py
View File

@@ -35,11 +35,11 @@ async def coop_context() -> dict:
ctx["menu_items"] = await get_navigation_tree(g.s)
# Cart data from cart app API
# Cart data from cart app API (includes both product + calendar counts)
cart_data = await api_get("cart", "/internal/cart/summary", forward_session=True)
if cart_data:
ctx["cart_count"] = cart_data.get("count", 0)
ctx["cart_total"] = cart_data.get("total", 0)
ctx["cart_count"] = cart_data.get("count", 0) + cart_data.get("calendar_count", 0)
ctx["cart_total"] = cart_data.get("total", 0) + cart_data.get("calendar_total", 0)
else:
ctx["cart_count"] = 0
ctx["cart_total"] = 0

2
shared

Submodule shared updated: 0c0f3c8416...e3f8ff6e3c