Fix cart quantities not showing on product list after page refresh
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 45s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 45s
The context processor loaded cart items but only passed aggregates (cart_count, cart_total) — not the cart list itself. Templates need the full list to display per-product quantities. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1
app.py
1
app.py
@@ -46,6 +46,7 @@ async def market_context() -> dict:
|
|||||||
cart_items = cart_result.scalars().all()
|
cart_items = cart_result.scalars().all()
|
||||||
|
|
||||||
from bp.cart.services import total
|
from bp.cart.services import total
|
||||||
|
ctx["cart"] = list(cart_items)
|
||||||
ctx["cart_count"] = sum(ci.quantity for ci in cart_items)
|
ctx["cart_count"] = sum(ci.quantity for ci in cart_items)
|
||||||
ctx["cart_total"] = total(cart_items) or 0
|
ctx["cart_total"] = total(cart_items) or 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user