Skip to content

Commit bf3850a

Browse files
committed
Fix cart products count
1 parent 95a1b28 commit bf3850a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/Cart/Cart.component.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ import { AppContext } from 'utils/context/AppContext';
1010
const Cart = ({ stickyNav }) => {
1111
const [cart] = useContext(AppContext);
1212

13-
const productsCount = cart.cart.contents.nodes.reduce(
13+
/*const productsCount = cart.contents.nodes.reduce(
1414
(total, product) => total + product.quantity,
1515
0
16-
);
16+
);*/
17+
18+
const productsCount =
19+
null !== cart && Object.keys(cart).length ? cart.totalProductsCount : '';
20+
21+
1722

1823
return (
1924
<>

0 commit comments

Comments
 (0)