From cb04d90c8887993f532d582e7cdb1780b86bd4be Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 7 Aug 2024 08:33:38 +0700
Subject: <iman> update error code voucher tidak terbaca

---
 src/lib/product/components/ProductCard.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index e10241a7..35e2a665 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -17,8 +17,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
   const [discount, setDiscount] = useState(0);
 
   let voucherPastiHemat = 0;
-
-  if (product?.voucherPastiHemat.length > 0) {
+  
+  if (product?.voucherPastiHemat ? product?.voucherPastiHemat.length : voucherPastiHemat > 0) {
     const stringVoucher = product?.voucherPastiHemat[0];
     const validJsonString = stringVoucher.replace(/'/g, '"');
     voucherPastiHemat = JSON.parse(validJsonString);
-- 
cgit v1.2.3

