skndash96/bountic #1
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.
Total Bounty
$ 35.00
USDC
Funder Leaderboard
Maintainers must login via GitHub to approve payout.
Bounty locked after merge of PR #2
BOUNTY LOCKEDApr 28, 10:42 AM
PR #2 by @skndash96 is competing for this bounty
PR COMPETINGApr 28, 10:13 AM
Anonymous added $10.00 via WEB
FUNDING ADDEDApr 27, 2:53 PM
Anonymous added $8.00 via WEB
FUNDING ADDEDApr 27, 1:11 PM
Wowzer added $2.00 via WEB
FUNDING ADDEDApr 27, 12:44 PM
Skndash added $5.00 via WEB
FUNDING ADDEDApr 27, 12:24 PM
Anon1 added $10.00 via WEB
FUNDING ADDEDApr 27, 12:21 PM