diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-11-18 11:31:39 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-11-18 11:31:39 +0700 |
| commit | 9d99b291bb347f045b03b2de6ee51a8fbc248721 (patch) | |
| tree | 0f6941ba3a5b68bc9ad93d3850e54dd88b017897 /src/lib/checkout/components/Checkout.jsx | |
| parent | 0f7ce7842c70bc1fee1ae6f3cff0ccf7be8eaa6f (diff) | |
| parent | bde516b6b39cccfe8ac3248cd7f85592e6298d7a (diff) | |
Merge branch 'new-release' into CR/website-improvement
Diffstat (limited to 'src/lib/checkout/components/Checkout.jsx')
| -rw-r--r-- | src/lib/checkout/components/Checkout.jsx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index afbf1e6c..6fb5cdb4 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -37,6 +37,18 @@ const SELF_PICKUP_ID = 32; const { checkoutApi } = require('../api/checkoutApi'); const { getProductsCheckout } = require('../api/checkoutApi'); +function convertToInternational(number) { + if (typeof number !== 'string') { + throw new Error("Input harus berupa string"); + } + + if (number.startsWith('08')) { + return '+62' + number.slice(2); + } + + return number; +} + const Checkout = () => { const router = useRouter(); const query = router.query.source ?? null; @@ -491,9 +503,11 @@ const Checkout = () => { gtag('set', 'user_data', { email: auth.email, - phone_number: auth.mobile ?? auth.phone, + phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone), }); + gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ; + for (const product of products) deleteItemCart({ productId: product.id }); if (grandTotal > 0) { const payment = await axios.post( |
