skndash96/bountic #4
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
$ 5.00
USDC
Funder Leaderboard
Maintainers must login via GitHub to approve payout.
Bounty locked after merge of PR #5
BOUNTY LOCKEDApr 28, 4:20 PM
Bounty locked after merge of PR #7
BOUNTY LOCKEDApr 28, 3:37 PM
PR #7 by @skndash96 is competing for this bounty
PR COMPETINGApr 28, 3:37 PM
PR #5 by @skndash96 is competing for this bounty
PR COMPETINGApr 28, 3:30 PM
Anon1 added $5.00 via WEB
FUNDING ADDEDApr 28, 3:29 PM
@skndash96 added Bounty label
BOUNTY CREATEDApr 28, 3:29 PM