Skip to content

Commit 5395a91

Browse files
Merge pull request #231 from mercurjs/fix/mm2-1565/cart-empty-when-item-is-added
MM2-1565 Fix: cart showing empty state after adding items
2 parents cd610d0 + 0e7cf96 commit 5395a91

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/sections/Cart/Cart.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
"use client"
2+
13
import { Button } from "@/components/atoms"
24
import { CartEmpty, CartItems, CartSummary } from "@/components/organisms"
35
import LocalizedClientLink from "@/components/molecules/LocalizedLink/LocalizedLink"
4-
import { retrieveCart } from "@/lib/data/cart"
56
import CartPromotionCode from "../CartReview/CartPromotionCode"
6-
import { EmptyCart } from "@/components/organisms/CartItems/EmptyCart"
7-
8-
export const Cart = async () => {
9-
const cart = await retrieveCart()
7+
import { useCartContext } from "@/components/providers"
108

9+
export const Cart = () => {
10+
const { cart } = useCartContext()
11+
1112
if (!cart || !cart.items?.length) {
1213
return <CartEmpty />
1314
}

0 commit comments

Comments
 (0)