From 71b30f5c313b0571ecf34c78ccc9887b57cfcbbc Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Sat, 22 Jul 2023 10:29:05 +0700
Subject: get discount value

---
 src/lib/checkout/components/Checkout.jsx | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 23a471aa..5a9dcf7f 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -164,9 +164,9 @@ const Checkout = () => {
     let dataVoucherIndex = listVouchers.findIndex((voucher) => voucher.code == code)
     let dataActiveVoucher = listVouchers[dataVoucherIndex]
 
-    let countDiscount = 0
+    let countDiscount = dataActiveVoucher.discountVoucher
 
-    if (dataActiveVoucher.discountType === 'percentage') {
+    /*if (dataActiveVoucher.discountType === 'percentage') {
       countDiscount = cartCheckout?.subtotal * (dataActiveVoucher.discountAmount / 100)
       if (
         dataActiveVoucher.maxDiscountAmount > 0 &&
@@ -176,7 +176,7 @@ const Checkout = () => {
       }
     } else {
       countDiscount = dataActiveVoucher.discountAmount
-    }
+    }*/
 
     return countDiscount
   }
@@ -562,7 +562,9 @@ const Checkout = () => {
                         {item.canApply && (
                           <p>
                             Potensi potongan sebesar{' '}
-                            <span className='text-red-500'>{item.discountVoucher}</span>
+                            <span className='text-red-500'>
+                              {currencyFormat(item.discountVoucher)}
+                            </span>
                           </p>
                         )}
                         {/* {item.canApply === false
-- 
cgit v1.2.3

