You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cart quantity badge doesn't increment when same product is added with notes #16
When an item is added to cart with notes/special instructions, and then more of the same item (without notes, or with different notes) is added, the quantity badge on the product grid tile does not increment. It only reflects the quantity of the first matching cart item, not the total across all variants of the same product.
Steps to Reproduce
Add "Latte" to cart (no notes) → grid badge shows 1 ✅
Add "Latte" again with notes "no sugar" → grid badge still shows 1 ❌ (should be 2)
Add "Latte" again without notes → grid badge still shows 1 ❌ (should be 3)
For items without notes, the badge increments correctly.
Root Cause
In frontend/src/store/cart.ts, the generateCartItemId function creates a unique cart item ID per product + addons + notes combination:
So "Latte" (no notes) and "Latte with no sugar" become two separate cart items with different IDs — which is correct for order processing.
But in frontend/src/components/pos/ProductGrid.tsx, the badge uses find():
constinCart=cart.items.find((i)=>i.product.id===product.id);// ...{inCart.quantity}// only shows quantity of FIRST match
find() returns only the first cart item matching the product ID, so the badge only shows that one item's quantity instead of the total across all variants.
Expected Behavior
The quantity badge should show the sum of all cart items for that product ID, regardless of notes/addons differences.
Activity
fix(pos): aggregate cart quantity for product grid badges (fixes Free…