summaryrefslogtreecommitdiff
path: root/src/pages/google_merchant
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-06 09:14:33 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-06 09:14:33 +0700
commit010cbf9ff08835ed0cf61e821ce4db79f744893c (patch)
treee14bbb3668393afaf3ef778b6203882ef8ea5275 /src/pages/google_merchant
parentd8ac722b56e3968c166fa17f8db3a323c7322ace (diff)
Update label on google merchant xml
Diffstat (limited to 'src/pages/google_merchant')
-rw-r--r--src/pages/google_merchant/products/[page].js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js
index 352b2989..d6309090 100644
--- a/src/pages/google_merchant/products/[page].js
+++ b/src/pages/google_merchant/products/[page].js
@@ -45,11 +45,15 @@ export async function getServerSideProps({ res, query }) {
'g:condition': { '#text': 'new' },
'g:availability': { '#text': availability },
'g:brand': { '#text': product.manufacture?.name || '' },
- 'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` },
- 'g:custom_label_0': {
- '#text': product.stockTotal > 0 ? 'Stok Tersedia' : 'Stok Tidak Tersedia'
- }
+ 'g:price': { '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR` }
+ }
+
+ if (product.stockTotal == 0) {
+ item['g:custom_label_0'] = { '#text': 'Stok Tidak Tersedia' }
+ } else {
+ item['g:custom_label_1'] = { '#text': 'Stok Tersedia' }
}
+
if (product.lowestPrice.discountPercentage > 0) {
item['g:sale_price'] = {
'#text': `${Math.round(product.lowestPrice.priceDiscount * 1.11)} IDR`