menu: fix product qty
This commit is contained in:
@@ -248,10 +248,12 @@ export function MenuList({ data, categoryRefs }: MenuListProps) {
|
|||||||
|
|
||||||
<AddToCartButton />
|
<AddToCartButton />
|
||||||
|
|
||||||
{items.find((i) => i.id === item.id) && (
|
{items.some((i) => i.id === item.id) && (
|
||||||
<Badge
|
<Badge
|
||||||
count={
|
count={
|
||||||
items.find((i) => i.id === item.id)?.quantity
|
items
|
||||||
|
.filter((i) => i.id === item.id)
|
||||||
|
.reduce((total, item) => total + item.quantity, 0)
|
||||||
}
|
}
|
||||||
className={
|
className={
|
||||||
styles.cartBadge +
|
styles.cartBadge +
|
||||||
@@ -264,7 +266,9 @@ export function MenuList({ data, categoryRefs }: MenuListProps) {
|
|||||||
backgroundColor: colors.primary,
|
backgroundColor: colors.primary,
|
||||||
}}
|
}}
|
||||||
title={`${
|
title={`${
|
||||||
items.find((i) => i.id === item.id)?.quantity
|
items
|
||||||
|
.filter((i) => i.id === item.id)
|
||||||
|
.reduce((total, item) => total + item.quantity, 0)
|
||||||
} in cart`}
|
} in cart`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user