You can configure products so that only products that are available for order show in your storefront search results.
You can control if a product appears in a search result when it's unavailable (ATS=0). Use the Searchable If Unavailable product attribute setting to control search results on a product-by-product basis.
Use the Show Orderable Products Only search preference to control at the site-level if unavailable products appear in search results. You can also use the Search API pipelet Show Orderable Products Only parameter and the dw.catalog.ProductSearchModel to programmatically override both the site-level and product-level settings.
The Searchable If Unavailable product attribute is defined and can be viewed by selecting Administration > Site Development > System Object Types > Product > Attribute Definitions.
You can edit this attribute on the product page and via bulk editing (Update/Delete Product attribute > attribute selection). You can use this attribute for an advanced product search (Search Result > By Attribute). You can import and export this setting (searchable-if-unavailable-flag) in catalog.xsd.
Here are some examples:
Products | Site search Preference | Results |
---|---|---|
Example 1 - Out-of-stock products appear in search results | ||
|
Show orderable products only is set to No. |
When the customer searches for bags, B2C Commerce shows:
|
Example 2 - Out-of-stock products don't appear in search results | ||
|
Show orderable products only is set to Yes. |
When the customer searches for bags, B2C Commerce shows:
|
Example 3 - Out-of-stock products don't appear in search results for some products | ||
|
Show orderable products only if set to Yes. For product Men's Leather Luggage Fisherman Bag, attribute Searchable If Unavailable is set to Yes (on base product level). For product Women's B-Flaps Shoulder Bag, attribute Searchable If Unavailable is undefined. |
When the customer searches for bags, B2C Commerce shows:
|
Example 4 - Using new attribute to remove discontinued product from search | ||
|
Show orderable products only if set to No. Searchable If Unavailable is undefined for both products. |
When the customer searches for bracelet, B2C Commerce shows:
|
Show orderable products only is set to No. User sets Searchable If Unavailable to No for product Women's Wrap Bracelet, and then rebuilds the product search index. |
When the customer searches for gps,B2C Commerce shows:
|
|
Example 5 - In-Store-Only products | ||
Women's New Rain Handbag is only sold in stores, but merchandised on the web site. Product has no inventory on the website. The custom attribute In-Store Only is set to Yes for product Women's New Rain Handbag. Custom code is in place to show a message for products flagged as In-Store Only. |
Show orderable products only is set to Yes. |
When the customer searches for bags,B2C Commerce shows:
The customer clicks the product to navigate to the product details page and a message appears: "In-store only!" |