Storefont API "totalInventory": null

Storefont API "totalInventory": null

2 0 2


I am building a headless storefront app. I am trying to use the product quantity to set that max available quantity on the product page. That would prevent a lot of UX  grief. I don't want the user to end up in the cart to only find out that quantity is too much. Then have to adjust quantity until they find the number that actually works. I feel this approach would create a lot of abandon carts. I read somewhere that the totalInventory on products is only available to admin....Which does not makes sense to me. This is a very common practice in e commerce. I have many years of experience building storefronts with other systems. 
I would have no issues with using admin, but it is extremely complicated to set up in Next.js and honestly would be overkill just to get a product quantity.
At this time I am getting "totalInventory": null on the store front side. The docs show it is a "non-null" value, so that is also misleading. I also attempted to use the variants quantityAvailable, but that comes back null as well.

Screen Shot 2022-10-21 at 10.44.25 AM.png

I hope that the quantity of the product is available in some way to check against. 


Replies 0 (0)