When a variant’s combined available across all locations drops below 0, the Storefront API returns the same negative, global total for quantityAvailable for every @inContext(country: …) request—instead of returning the country-scoped availability for the locations that serve that market. This works correctly while the global net is ≥ 0 and breaks only when the global net is < 0.
This causes incorrect availability on international storefronts that rely on country context.
Environment
-
API: Storefront API (GraphQL)
-
Query:
@inContext(country: XX)→ProductVariant.quantityAvailable(andavailableForSale) -
Markets / Locations: AU, US, CA mapped to distinct locations/fulfillment networks
-
Screenshots provided
Data Setup (from Admin > Inventory)
Scenario A (works as expected):
-
AU location: 69 available
-
US location: 4 available
-
CA location: 9 available
-
Global total: +82
Scenario B (bug):
-
AU location: 69 available
-
US location: -100 available (oversell/negative adjustment)
-
CA location: 9 available
-
Global total: -22
Reproduction (Storefront API)
Query (run 3 times with different country):
query VariantQty($variantId: ID!) @inContext(country: AU) {
node(id: $variantId) {
... on ProductVariant {
id
availableForSale
quantityAvailable
}
}
}
Repeat exactly with country: US and country: CA.
Expected
-
With Scenario A (global ≥ 0)
-
country: AU→quantityAvailable = 69 -
country: US→quantityAvailable = 4 -
country: CA→quantityAvailable = 9
-
-
With Scenario B (global < 0)
-
country: AU→quantityAvailable = 69 -
country: US→quantityAvailable = -100or0(if negatives are clamped for sellable quantity) -
country: CA→quantityAvailable = 9
-
Actual (Scenario B when Total is -22)
-
country: AU→quantityAvailable = -22 -
country: US→quantityAvailable = -22 -
country: CA→quantityAvailable = -22
In other words, when the global net across all locations is negative, every @inContext(country:) call returns the same global negative number for quantityAvailable, ignoring country/location scoping.
Impact
-
Country-specific PDPs show the same negative availability regardless of market, which:
-
Blocks sales in countries that do have stock (e.g., AU with 69 available).
-
Breaks channel/market routing that depends on
@inContext.
-
-
Forces fragile client-side workarounds (clamping or re-implementing market scoping).
Severity: High for multi-market merchants using @inContext.
Notes / Hypothesis
-
The Storefront resolver for
quantityAvailableappears to:-
Correctly scope to market while global net ≥ 0; but
-
Fall back to a global sum (without market scoping) when the global sum < 0.
-
-
availableForSalefollows the same faulty behavior (mirrors the incorrect negative/global result).
What we’re asking Shopify to confirm / fix
-
Intended behavior: With
@inContext(country: XX),quantityAvailablemust reflect only the locations serving that country/market—even if the global sum is negative. -
Patch the Storefront resolver to avoid substituting the global negative sum for all country contexts.
Temporary Workarounds
-
Setting the inventory quantity to a number equal or greater than 0 for each location, but this is not ideal, and we shouldn’t have to do this, especially if we are committed to overselling when items are out of stock, or for other reasons.
-
The API should behave consistently.
-
I also must add that we are going live in 2 weeks and really need this issue resolved. Thanks!


