From 1e3610d432724279f30d8b85daff076dfb920f6d Mon Sep 17 00:00:00 2001 From: Vedanshu Jain Date: Mon, 11 Nov 2024 13:13:51 +0530 Subject: [PATCH] Use default to prevent empty cart crash. --- docs/js/serverless-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/js/serverless-api.js b/docs/js/serverless-api.js index a134b7b..c2df320 100644 --- a/docs/js/serverless-api.js +++ b/docs/js/serverless-api.js @@ -90,7 +90,7 @@ class ServerlessWooAPI { async getCartItemQuantity(productId) { const cart = await this.getCart(); - const item = cart.items[productId]; + const item = (cart.items || {})[productId]; return item ? item.quantity : 0; } }