Node.js version
24
Database and its version
16.2
Operating system name and version
Linux
Browser name
No response
What happended?
As per the documentation, the GET cart endpoint supports returning items.variant.inventory_quantity
but it doesn't return. See actual behaviour section for the actual request and response.
Expected behavior
Expected behaviour is that the GET cart API endpoint returns the items.variant.inventory_quantity when requests, but it ignores this field.
Actual behavior
return await sdk.client
.fetch<HttpTypes.StoreCartResponse>(`/store/carts/${id}`, {
method: "GET",
query: {
fields:
"*items, *region, *items.product, *items.variant, +items.variant.inventory_quantity, *items.thumbnail, *items.metadata, +items.total, *promotions, +shipping_methods.name",
},
headers,
next,
// cache: "force-cache",
})
I tried the following:
*items.variant, +items.variant.inventory_quantity
The field is missing in the response
*items.variant.inventory_quantity
error: Entity 'ProductVariant' does not have property 'inventory_quantity'
ValidationError: Entity 'ProductVariant' does not have property 'inventory_quantity'
*items.variants.inventory_quantity and many other trials
TypeError: Cannot read properties of undefined (reading 'strategy')
What's the proper way to retrieve inventory_quantity during cart GET?
Why do I need this? Because I have to prevent this flow:
- A customer adds a product to the cart.
- Abandon cart for a day
- The product becomes out of stock
- Customer comes back and checkouts
- No error until the customer clicks Place Order
So i have to prevent this.
Node.js version
24
Database and its version
16.2
Operating system name and version
Linux
Browser name
No response
What happended?
As per the documentation, the GET cart endpoint supports returning
items.variant.inventory_quantitybut it doesn't return. See actual behaviour section for the actual request and response.
Expected behavior
Expected behaviour is that the GET cart API endpoint returns the
items.variant.inventory_quantitywhen requests, but it ignores this field.Actual behavior
I tried the following:
*items.variant, +items.variant.inventory_quantityThe field is missing in the response
*items.variant.inventory_quantityerror: Entity 'ProductVariant' does not have property 'inventory_quantity'
ValidationError: Entity 'ProductVariant' does not have property 'inventory_quantity'
*items.variants.inventory_quantityand many other trialsTypeError: Cannot read properties of undefined (reading 'strategy')
What's the proper way to retrieve
inventory_quantityduring cart GET?Why do I need this? Because I have to prevent this flow:
So i have to prevent this.
💰 Bountic Ledger
Issue:
skndash96/bountic#12Status: 🟢 OPEN
Total Bounty: $10.00 USDC
Leaderboard
This comment is managed by Bountic and stays pinned for quick tracking.