We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68b602e commit f3b1986Copy full SHA for f3b1986
components/Cart/Cart.component.jsx
@@ -4,18 +4,19 @@ import Link from 'next/link';
4
import { AppContext } from 'utils/context/AppContext';
5
6
/**
7
- * Displays the shopping cart contents. *
+ * Displays the shopping cart contents. *
8
* Displays amount of items in cart.
9
*/
10
const Cart = ({ stickyNav }) => {
11
const [cart] = useContext(AppContext);
12
13
- const productsCount =
14
- null !== cart && Object.keys(cart).length ? cart.totalProductsCount : '';
+ const productsCount = cart.cart.contents.nodes.reduce(
+ (total, product) => total + product.quantity,
15
+ 0
16
+ );
17
18
return (
19
<>
-
20
<Link href="/handlekurv">
21
<span
22
className="pl-4 mt-4 no-underline inline-block"
0 commit comments