From 40b5e915d5675ed8d0e6f18860fb8f5e6a7ce59b Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 4 Jul 2023 14:48:03 +0700 Subject: Update availability on google merchant xml --- src/pages/google_merchant/products/[page].js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 65e1ebbe..5a417807 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -34,6 +34,8 @@ export async function getServerSideProps({ res, query }) { product.description = defaultProductDescription } + const availability = product?.stockTotal > 0 ? 'in_stock' : 'preorder' + const item = { 'g:id': { '#text': productId }, 'g:title': { '#text': toTitleCase(product.name) }, @@ -41,7 +43,7 @@ export async function getServerSideProps({ res, query }) { 'g:link': { '#text': productUrl }, 'g:image_link': { '#text': product.image }, 'g:condition': { '#text': 'new' }, - 'g:availability': { '#text': 'in_stock' }, + 'g:availability': { '#text': availability }, 'g:brand': { '#text': product.manufacture?.name || '' }, 'g:price': { '#text': `${Math.floor(product.lowestPrice.price * 1.11)} IDR` } } -- cgit v1.2.3