Returns availability for multiple products. If inventoryIds is omitted, availability is returned from the site-assigned default inventory list. If inventoryIds is provided, availability is returned only from the specified inventory lists. The maximum number of product IDs that you can request is 24. The maximum number of inventory list IDs you can request is 5. The productIds parameter accepts product IDs for any product type (master, variant, standard, set, or bundle). Products that are offline or not found are silently filtered from the response. To retrieve availability for all variants of a master product, use the expand=variations parameter. Use the productId from each entry in the Shopper Products API variants array to look up availability for a specific variant.
If you would like to get a raw Response object use the other getAvailability function.
An object containing the options for this method.
A promise of type AvailabilityResult.
Returns availability for multiple products. If inventoryIds is omitted, availability is returned from the site-assigned default inventory list. If inventoryIds is provided, availability is returned only from the specified inventory lists. The maximum number of product IDs that you can request is 24. The maximum number of inventory list IDs you can request is 5. The productIds parameter accepts product IDs for any product type (master, variant, standard, set, or bundle). Products that are offline or not found are silently filtered from the response. To retrieve availability for all variants of a master product, use the expand=variations parameter. Use the productId from each entry in the Shopper Products API variants array to look up availability for a specific variant.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type AvailabilityResult otherwise.
Generated using TypeDoc
Shopper Availability
*Download API specification
API Overview
Use the Shopper Availability API enables to retrieve inventory availability for products without fetching full product details. This allows independent caching strategies for volatile availability data and stable product data.
Use
/availabilityto retrieve availability for products. If theinventoryIdsparameter is omitted, availability is returned from the site-assigned default inventory list. IfinventoryIdsis provided, availability is returned only from the specified inventory lists.Caching is provided for the Shopper Availability API. For details, see Server-Side Web-Tier Caching.
Authentication & Authorization
The client requesting the availability information must have access to the Availability resource. The Shopper Availability API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
You must include the relevant scopes in the client ID used to generate the SLAS token. For a full list of required permissions, see the Authorization Scopes Catalog.
For details on how to request a shopper access token from SLAS, see the guest user flows for public clients and private clients in the SLAS guides.
Use Cases
Retrieve Product Availability
Use the Shopper Availability API so that a customer can see whether products are in stock. This API returns availability details, including stock levels and inventory status, for up to 24 products per request.
Retrieve Availability from Specific Inventory Lists
Use the
inventoryIdsparameter to retrieve availability from specific inventory lists rather than the site-assigned default. This is useful for scenarios such as showing availability at specific store locations or warehouses. You can request availability from up to 5 inventory lists per request.Retrieve Availability for Product Variations
Use the
expand=variationsparameter to retrieve availability for all variants of a master product in a single request. Use theproductIdfrom each entry in the Shopper Products APIvariantsarray to look up availability for a specific variant.Use Hooks
For details working with hooks, see Extensibility with Hooks.*
Simple example:
API Version: 0.0.33import { ShopperAvailability } from "commerce-sdk-isomorphic"; const clientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; const shopperAvailabilityClient = new ShopperAvailability(clientConfig);Last Updated: