add extra price
This commit is contained in:
@@ -626,7 +626,15 @@ export const selectCartItems = (state: RootState) => state.order.items;
|
||||
|
||||
export const selectCartTotal = (state: RootState) =>
|
||||
state.order.items.reduce(
|
||||
(total, item) => total + item.price * item.quantity,
|
||||
// (total, item) => total + item.price * item.quantity,
|
||||
(total, item) => {
|
||||
const extrasPrice = (item.extras || []).reduce(
|
||||
(extraTotal, extraItem) => extraTotal + extraItem.price,
|
||||
0,
|
||||
);
|
||||
const itemTotalPrice = (item.price + extrasPrice) * item.quantity;
|
||||
return total + itemTotalPrice;
|
||||
},
|
||||
0,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user