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/product/components/ProductCard.jsx | 10 ++++++++--
 1 file changed, 8 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 725e6efe..9300643e 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -2,8 +2,14 @@ import Image from '@/core/components/elements/Image/Image'
 import Link from '@/core/components/elements/Link/Link'
 import currencyFormat from '@/core/utils/currencyFormat'
 import { createSlug } from '@/core/utils/slug'
+import whatsappUrl from '@/core/utils/whatsappUrl'
 
 const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
+  const callForPriceWhatsapp = whatsappUrl('product', {
+    name: product.name,
+    url: createSlug('/shop/product/', product.name, product.id, true)
+  })
+
   if (variant == 'vertical') {
     return (
       <div className='rounded shadow-sm border border-gray_r-4 h-full bg-white'>
@@ -58,7 +64,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
             {product?.lowestPrice.priceDiscount > 0 ? (
               currencyFormat(product?.lowestPrice.priceDiscount)
             ) : (
-              <a href='https://wa.me/628128080622'>Call for price</a>
+              <a href={callForPriceWhatsapp}>Call for price</a>
             )}
           </div>
 
@@ -130,7 +136,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
             {product?.lowestPrice?.priceDiscount > 0 ? (
               currencyFormat(product?.lowestPrice?.priceDiscount)
             ) : (
-              <a href='https://wa.me/628128080622'>Call for price</a>
+              <a href={callForPriceWhatsapp}>Call for price</a>
             )}
           </div>
 
-- 
cgit v1.2.3

