Controlling unavailable products in search results
Key Takeaway
To hide unavailable (ATS=0) products across a site, turn on the "Show Orderable Products Only" search preference, which needs the Availability Search Index. To keep a specific product searchable when it is unavailable, set its "Searchable If Unavailable" attribute to Yes.
B2C Commerce lets you decide whether products that can't be ordered show up in storefront search results. You can hide them for the whole site or override that choice one product at a time. You can also keep them in results but push them to the end.
Hiding unavailable products for the whole site
The Show Orderable Products Only search preference works at the site level. When it is on, products whose inventory record has ATS=0 are left out of search results.
Show Orderable Products Only requires the site to be configured to use the Availability Search Index. When Shop the Store is enabled, search results consider both site inventory and store inventory.
Hiding works at the variation level, so a base product can appear in search results with some of its variations hidden.
A store sells a rain jacket in Navy and Gray, and a wool hat in Olive only. Navy is in stock, while Gray and Olive have ATS=0. With Show Orderable Products Only on, a shopper's search shows the rain jacket in Navy only. The wool hat doesn't appear at all, because its only color is unavailable.