summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pages/google_merchant/products/[page].js4
1 files changed, 3 insertions, 1 deletions
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` }
}