You can query inventory information using the GraphQL Storefront API. The information accessible by any storefront API is controlled by the inventory settings for the store.
For example queries, see Query Inventory with the GraphQL Storefront API.
Use these scopes to read and change the following information:
- The total inventory quantity of a particular product or variant that is available for shoppers across all visible locations
- The inventory quantity of a particular variant that is available at a specified location
Regardless of physical stock levels, inventory quantities may return
null depending on the store's inventory settings, accessible through the Settings API or the Settings > Inventory page in the store control panel.
In the following cases, inventory-related storefront queries may return different responses than expected:
|Out-of-stock products are hidden from the storefront||No responses will contain that product|
|Stock levels are hidden from the storefront||Inventory levels will always return |
|Only products low in stock display inventory levels||Inventory levels for products with quantities above the low-stock threshold will always return |
A store's inventory settings also affect inventory levels for variants. To see examples of these responses, see Query Inventory with the GraphQL Storefront API.
- When a location is enabled, its inventory of products and variants is accessible to the storefront. This inventory is included in the aggregate stock for a product or variant.
- If a location is enabled and visible, its inventory is fetched when you query the stock for a variant at each location.
To enable locations and change location visibility, use the Update locations endpoint.