Exclude Unavailable Products from Search Results
The Salesforce B2C Commerce Search module enables you to exclude unavailable products from search results in the storefront at the site level and at the product level. This is to avoid frustrating customers by showing them products they can't purchase.
The site-level feature, describe here, is only useful for sites that use an inventory list to control availability. The deprecated in-stock product attribute doesn't control the availability.
A product is considered available if one of the following is true:
- It has an inventory record with an
ATS > 0
, or - It has no inventory record but the default-in-stock flag of the site inventory list is true.
Inventory records for base products have no effect on whether or not they appear in search results because the availability of such products is determined by the availability of their variation products. The same is true for product-sets. Bundled products are available if one of the following is true:
- It has an inventory record with an
ATS > 0
. - It has no inventory record, and the ATS (which is calculated based on the availability of the bundled products) > 0.
To remove unavailable products from searches:
- Select .
- Check the option Show Orderable Products Only.
- Navigate to and rebuild the product index.
If a merchant requires the flexibility to show or hide unavailable
products per query, the Business Manager Show Orderable Products Only option might be
overridden programmatically. The Search pipelet offers an optional input parameter,
OrderableProductsOnly
, which can be used to specify the desired behavior.
The class dw.catalog.ProductSearchModel
, has a similar property.