From 93832023b7c2f560bd90a02e9768d0fccec79078 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 3 May 2023 16:03:45 +0700
Subject: whatsapp url

---
 src/lib/checkout/components/Checkout.jsx | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 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 0a8b072a..dc3908db 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -19,6 +19,8 @@ import axios from 'axios'
 import Image from '@/core/components/elements/Image/Image'
 import MobileView from '@/core/components/views/MobileView'
 import DesktopView from '@/core/components/views/DesktopView'
+import whatsappUrl from '@/core/utils/whatsappUrl'
+import { createSlug } from '@/core/utils/slug'
 
 const Checkout = () => {
   const router = useRouter()
@@ -251,7 +253,7 @@ const Checkout = () => {
           <div className='px-4 mb-4'>
             <span className='text-danger-500'>
               *) Terdapat produk yang belum memiliki harga,{' '}
-              <a href='https://wa.me/628128080622' className='underline'>
+              <a href={whatsappUrl()} className='underline'>
                 Hubungi Kami untuk meminta harga.
               </a>
             </span>
@@ -330,7 +332,13 @@ const Checkout = () => {
                           {product.price.priceDiscount > 0 ? (
                             currencyFormat(product?.price?.priceDiscount * product?.quantity)
                           ) : (
-                            <a href='https://wa.me/628128080622' className='underline'>
+                            <a
+                              href={whatsappUrl('product', {
+                                name: product.name,
+                                url: createSlug('/shop/product/', product.name, product.id, true)
+                              })}
+                              className='underline'
+                            >
                               Call For Price{' '}
                             </a>
                           )}
@@ -423,7 +431,7 @@ const Checkout = () => {
                 <div className='mt-4'>
                   <span className='text-danger-500'>
                     *) Terdapat produk yang belum memiliki harga,{' '}
-                    <a href='https://wa.me/628128080622' className='underline'>
+                    <a href={whatsappUrl()} className='underline'>
                       Hubungi Kami untuk meminta harga.
                     </a>
                   </span>
-- 
cgit v1.2.3

