Cart Count will be Number of items rather than sum total quantity

This commit is contained in:
Pruthvi 2020-10-29 17:12:09 +05:30
parent 629df7a9ab
commit 7fd402adde

View File

@ -14,7 +14,7 @@ interface Props {
className?: string className?: string
} }
const countItem = (count: number, item: any) => count + item.quantity const countItem = (count: number, item: any) => count + (item.quantity > 0 ? 1 : 0)
const countItems = (count: number, items: any[]) => const countItems = (count: number, items: any[]) =>
items.reduce(countItem, count) items.reduce(countItem, count)