From d22df6bd30b8ed4bcfa938dcbbedc5fc376c2304 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Mon, 20 Feb 2023 10:49:35 +0700
Subject: cart refactor

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

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

diff --git a/src/lib/product/components/Product.jsx b/src/lib/product/components/Product.jsx
index 396eba5f..39d29d4d 100644
--- a/src/lib/product/components/Product.jsx
+++ b/src/lib/product/components/Product.jsx
@@ -8,7 +8,7 @@ import Select from "react-select"
 import ProductSimilar from "./ProductSimilar"
 import LazyLoad from "react-lazy-load"
 import { toast } from "react-hot-toast"
-import { addItemCart } from "@/core/utils/cart"
+import { updateItemCart } from "@/core/utils/cart"
 
 const informationTabOptions = [
   { value: 'specification', label: 'Spesifikasi' },
@@ -75,7 +75,7 @@ const Product = ({ product }) => {
       toast.error('Jumlah barang minimal 1')
       return
     }
-    addItemCart({
+    updateItemCart({
       productId: activeVariant.id,
       quantity
     })
@@ -98,7 +98,7 @@ const Product = ({ product }) => {
         { activeVariant?.price?.discountPercentage > 0 && (
           <div className="flex gap-x-1 items-center mt-2">
             <div className="text-gray_r-11 line-through text-caption-1">
-              {currencyFormat(activeVariant?.price?.priceDiscount)}
+              {currencyFormat(activeVariant?.price?.price)}
             </div>
             <Badge type="solid-red">
               {activeVariant?.price?.discountPercentage}%
@@ -106,7 +106,7 @@ const Product = ({ product }) => {
           </div>
         ) }
         <h3 className="text-red_r-11 font-semibold mt-1">
-          { activeVariant?.price?.price > 0 ? currencyFormat(activeVariant?.price?.price) : (
+          { activeVariant?.price?.priceDiscount > 0 ? currencyFormat(activeVariant?.price?.priceDiscount) : (
             <span className="text-gray_r-11 leading-6 font-normal">
               Hubungi kami untuk dapatkan harga terbaik,&nbsp;
               <a href="https://wa.me/" className="text-red_r-11 underline">klik disini</a>
-- 
cgit v1.2.3

