blob: 4822468f058b9ec2b09d12de99a8125689329a1d (
plain)
1
2
3
4
5
6
|
export default function calcTotalPrice(cart) {
return cart.reduce((tally, cartItem) => {
if (!cartItem.item) return tally;
return tally + cartItem.quantity * cartItem.item.price;
}, 0);
}
|