summaryrefslogtreecommitdiff
path: root/src-migrate/pages
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-11-13 14:47:56 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-11-13 14:47:56 +0700
commit2c74398c6f75de3b5620d6495d7701553b66eb40 (patch)
treea6c48649d18ca56189ce621f823754db66d7a138 /src-migrate/pages
parent7966f67569d01c25f7a337962d7d0bb1a0c57808 (diff)
parent399e7b149bd409e0b5a96fd8c6eaac4f23181ef0 (diff)
Merge branch 'new-release' into feature/integrasi_biteship
Diffstat (limited to 'src-migrate/pages')
-rw-r--r--src-migrate/pages/shop/cart/index.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index c5386c91..70a28073 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -35,6 +35,8 @@ const CartPage = () => {
const [hasChanged, setHasChanged] = useState(false);
const prevCartRef = useRef<CartItem[] | null>(null);
+ console.log('ini cart', cart);
+
useEffect(() => {
const handleScroll = () => {
setIsTop(window.scrollY < 200);
@@ -84,19 +86,19 @@ const CartPage = () => {
const hasSelectedPromo = useMemo(() => {
if (!cart) return false;
- return cart.products.some(
+ return cart?.products?.some(
(item) => item.cart_type === 'promotion' && item.selected
);
}, [cart]);
const hasSelected = useMemo(() => {
if (!cart) return false;
- return cart.products.some((item) => item.selected);
+ return cart?.products?.some((item) => item.selected);
}, [cart]);
const hasSelectNoPrice = useMemo(() => {
if (!cart) return false;
- return cart.products.some(
+ return cart?.products?.some(
(item) => item.selected && item.price.price_discount === 0
);
}, [cart]);
@@ -230,7 +232,7 @@ const CartPage = () => {
</div>
<div className={style['items']}>
- {cart?.products.map((item) => (
+ {cart?.products?.map((item) => (
<CartItemModule key={item.id} item={item} />
))}