Skip to content

Commit

Permalink
Use default to prevent empty cart crash.
Browse files Browse the repository at this point in the history
  • Loading branch information
vedanshujain committed Nov 11, 2024
1 parent a252b5f commit 1e3610d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/js/serverless-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 1e3610d

Please sign in to comment.