Need unauthenticated_read_product_inventory to access quantityAvailable?

Need unauthenticated_read_product_inventory to access quantityAvailable?

JohnFoxtrot
Shopify Partner
6 1 2

As per the Storefront API documentation (2022-10), only "unauthenticated_read_product_listings" is required to access quantityAvailable via the following request:

 

product(handle: $productH) {
variants(first: 100) {
edges {
node {
quantityAvailable
}
}
}
}
}    

However, initial requests were rejected with an error informing me I need "unauthenticated_read_product_inventory" access scopes. When I added that exact access scope it worked, but I'm confused because the API docs didn't mention it and the complete list of Shopify access scopes doesn't list it.

 

Seems like this has been deprecated in the documentation but not on the backend? Just looking for clarification for myself and the community. Thank you.

Replies 4 (4)

chase-mo
Shopify Partner
7 0 0

hey, i just ran into this same problem.

 

i can use `availableForSale` to determine if a variant is out of stock -- but this bums me out because i was excited to do "only 2 left in stock!", but it looks like that's not possible due to this bug 😞

chase-mo
Shopify Partner
7 0 0

in addition to "quantityAvailable" throwing that error,

 

i am also getting an error for "totalInventory" on a products(query)

 

Access denied for totalInventory field. Required access: `unauthenticated_read_product_inventory` access scope.
sorin_12
Visitor
3 0 0

I have the same problem, I don`t understand why is this now working. My permissions are set to access_product_inventory in my storefront api permissions.

ddddbbbbb
Shopify Partner
1 0 0

FYI to anyone else coming across this problem... a Shopify staff developer mentioned here that this "unauthenticated_read_product_inventory" scope is not available to checkout UI extensions. Its annoying that Shopify wont update the community about this issue or mention this in the documentation.