- Adds a
storeAvailabilityattribute that contains the IDs of stores where a variant is available. - Sends this attribute with every product (variant or product level, depending on your record model).
storeAvailability attribute identifies stores where a product variant is in stock.
It doesn’t include stock quantities.
Before you begin
This feature requires:- Algolia Search & Discovery cartridge version 25.3.0 or later.
- Salesforce’s
plugin_instorepickupcartridge. Theplugin_instorepickuprepository requires authenticated access.
plugin_instorepickup fully replace SFRA endpoints instead of extending them.
Place the plugin_instorepickup cartridge before app_storefront_base and after the Algolia cartridges.
This order ensures that Algolia extensions to these endpoints aren’t overridden (for example, Cart-AddProduct).
The
plugin_instorepickup cartridge relies on features from B2C Compatibility Mode 21.2, such as Number.isNaN().
If you use compatibility mode 19.10 or 18.10 (the minimum supported by the Algolia cartridge), you may encounter errors.
To resolve these errors, update to compatibility mode 21.2 or later, or adjust the plugin_instorepickup cartridge.storeAvailability after checkout when an order makes a product go out of stock.
Enable store-inventory indexing
- Go to Merchant Tools > Algolia > Algolia in the Business Manager.
- In Additional Product Attributes, append
storeAvailabilityand click Apply. Indexing jobs recognize this attribute.
- Retrieves each variant’s available-to-sell (ATS) value per store.
- Adds the store’s ID to
storeAvailabilityif the ATS is ≥ In Stock Threshold (defined in your custom preferences).
JSON
storeAvailability:
- Variation product: at the record root.
- Base product and Attribute-sliced (26.1.0 or later):: inside each entry in
variants.
Understand the size impact
If you run hundreds of stores,storeAvailability can add several kilobytes per record.
To limit the impact:
- Use short store IDs or a custom mapping that translates an abbreviated ID to a friendly name on the frontend.
- Use post processing to filter out stores that aren’t relevant to your business.
Add an In stock at store facet
After the attribute exists in your , create a facet:- Go to the Algolia dashboard and select your Algolia application.
- On the left sidebar, select Search.
- Select your product index for the relevant site and locale.
- In Configuration > Facets, add
storeAvailabilityto the Attributes for faceting list. - Save the settings.
How the storefront resolves the “Store” facet
- The SFRA Search controller passes a JSON array of store details to
searchResultsNoDecorator.ismlaspdict.storeList. - The
storeAvailabilityfield in each product record includes astoreIdsarray that lists the stores carrying the item. - When the store facet renders, the frontend looks up each store ID in
pdict.storeListand displays the corresponding store name.