From e1ff41a752b29caf901c7f2794c55ff4b42f0677 Mon Sep 17 00:00:00 2001 From: Anton Gundermann Date: Thu, 10 Aug 2023 10:14:52 +0200 Subject: [PATCH] fixed: issue #7 & #8 --- src/Components/Cart.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Components/Cart.jsx b/src/Components/Cart.jsx index b7cdf23..b75a505 100644 --- a/src/Components/Cart.jsx +++ b/src/Components/Cart.jsx @@ -3,6 +3,8 @@ import { XIcon, ShoppingCartIcon } from '@heroicons/react/outline' import React, { Fragment } from 'react' export default function Cart({ open, setOpen, cart, updateCart }) { + const subTotal = cart.reduce((s, p) => p.price * p.quantity + s, 0) + return ( setOpen(false)} > @@ -143,7 +146,7 @@ export default function Cart({ open, setOpen, cart, updateCart }) {

Subtotal

-

$262.00

+

${subTotal.toFixed(2)}

Shipping and taxes calculated at checkout.