summaryrefslogtreecommitdiff
path: root/src-migrate/modules/cart
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-04 09:50:46 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-04 09:50:46 +0700
commitcbdeecd2fb8770afe46a374292e6ed3e5ec48214 (patch)
tree9096b5d726b261f50222d9c50d8bb98c12cb6c4a /src-migrate/modules/cart
parent985f29aa1d9b8cbea49d25c30099f88c86bdc13f (diff)
parent702b5d9b6e215ad812fadaff3325e1e6164d3b24 (diff)
Merge branch 'Feature/new-cart-popup' into backup-release
Diffstat (limited to 'src-migrate/modules/cart')
-rw-r--r--src-migrate/modules/cart/components/ItemAction.tsx1
-rw-r--r--src-migrate/modules/cart/stores/useCartStore.ts4
2 files changed, 2 insertions, 3 deletions
diff --git a/src-migrate/modules/cart/components/ItemAction.tsx b/src-migrate/modules/cart/components/ItemAction.tsx
index e5e7f314..7220e362 100644
--- a/src-migrate/modules/cart/components/ItemAction.tsx
+++ b/src-migrate/modules/cart/components/ItemAction.tsx
@@ -13,7 +13,6 @@ import { useDebounce } from 'usehooks-ts'
import { useCartStore } from '../stores/useCartStore'
import { useProductCartContext } from '@/contexts/ProductCartContext'
-
type Props = {
item: CartItem
}
diff --git a/src-migrate/modules/cart/stores/useCartStore.ts b/src-migrate/modules/cart/stores/useCartStore.ts
index 3b50ec32..c2ebf50f 100644
--- a/src-migrate/modules/cart/stores/useCartStore.ts
+++ b/src-migrate/modules/cart/stores/useCartStore.ts
@@ -54,7 +54,7 @@ export const useCartStore = create<State & Action>((set, get) => ({
const computeSummary = (cart: CartProps) => {
let subtotal = 0;
let discount = 0;
- for (const item of cart.products) {
+ for (const item of cart?.products) {
if (!item.selected) continue;
let price = 0;
@@ -71,4 +71,4 @@ const computeSummary = (cart: CartProps) => {
let grandTotal = total + tax;
return { subtotal, discount, total, tax, grandTotal };
-};
+}; \ No newline at end of file