From a235f77530f0f51b3637b4b1096552fe3058ed69 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 16 Jun 2023 10:10:25 +0700 Subject: Add gtag begin_checkout and purchase event --- src/lib/cart/components/Cart.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/cart') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 907d1267..8c4e7d42 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -17,6 +17,7 @@ import DesktopView from '@/core/components/views/DesktopView' import ProductCard from '@/lib/product/components/ProductCard' import productSearchApi from '@/lib/product/api/productSearchApi' import whatsappUrl from '@/core/utils/whatsappUrl' +import { gtagBeginCheckout } from '@/core/utils/googleTag' const Cart = () => { const router = useRouter() @@ -134,6 +135,11 @@ const Cart = () => { toast.success('Berhasil menghapus barang dari keranjang') } + const handleCheckout = () => { + gtagBeginCheckout(products) + router.push('/shop/checkout') + } + return ( <> { type='button' className='btn-solid-red flex-1' disabled={selectedProduct().length == 0} - onClick={() => router.push('/shop/checkout')} + onClick={handleCheckout} > Checkout -- cgit v1.2.3 From dea8af5e7293d5e656a8a70b45b47a458420ed41 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 16 Jun 2023 14:01:58 +0700 Subject: Update cart detail --- src/lib/cart/components/Cart.jsx | 48 +++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'src/lib/cart') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 8c4e7d42..c02f976f 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -140,6 +140,10 @@ const Cart = () => { router.push('/shop/checkout') } + const totalOrder = totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount + const tax = totalOrder * 0.11 + const totalPrice = totalOrder + tax + return ( <> { ))}
-
-
- Total: - -   - {selectedProduct().length > 0 - ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) - : '-'} - +
+
+ Total Pesanan + {currencyFormat(totalOrder)} +
+
+ PPN 11% + {currencyFormat(tax)} +
+
+
+ Total Harga: + {currencyFormat(totalPrice)}
@@ -447,15 +455,19 @@ const Cart = () => {

Ringkasan Belanja

-
-
- Total: - -   - {selectedProduct().length > 0 - ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) - : '-'} - +
+
+ Total Pesanan + {currencyFormat(totalOrder)} +
+
+ PPN 11% + {currencyFormat(tax)} +
+
+
+ Total Harga: + {currencyFormat(totalPrice)}
-- cgit v1.2.3