The availability of products is the most dynamic information on an ecommerce site. In most cases, stock information is updated every day from an ERP, then it changes in real time based on customer interaction. In fact, the stock quantity decrements every time you place an order. If there's a reservation system, the stock might also be reserved when an item is added to the cart, likely for a predefined period of time.
No matter what stock availability strategy you use, an item can run out of stock, which means it can't be temporarily purchased online. When this happens, businesses have two options: remove the product from the website or keep it online with a different call to action. There are pros and cons to both approaches, plus a possible third way that might be the best compromise.
Option 1: Remove out of stock products from the website
Displaying out of stock products can frustrate customers and hurt conversions. Therefore, removing out of stock products from your website is the most common solution. Due to the dynamic nature of stock data, this approach requires continuous updating of what’s published and what’s not. Whenever an item goes out of stock, you have to take its product page down. All product listing pages (including search results) that include that product need to be updated as well. Keep in mind that if you sell products with variants, the product is gone when all its variants are out of stock.
Ideally, this logic should be event-driven. The commerce engine (or the OMS) should trigger an event, so all the other parts of the stack can be updated. Alternatively, you can use an asynchronous job that keeps all systems aligned in near real-time, such as every minute or two. If your catalog isn't too big, this can work. Otherwise, it can get cumbersome and cause misalignments.
An important aspect to consider is SEO. When a user clicks on a search result for an unpublished product page, a 404 response will be displayed. Besides having a negative impact on their experience, this behavior would also affect your site's ranking. As a solution, you could 301 redirect the product page URL to the product's main category page, so the link juice is transferred and the customer isn't left with nothing.
Option 2: Display out of stock products on the website
It makes sense to remove out of stock products from a website, but it's not the only option. An alternative is to always keep products online, no matter what their availability status is. In such cases, out of stock events or asynchronous jobs would just update the stock information, without publishing or unpublishing products. There would be no impact on SEO since all product pages would always be visible to search engines. Instead, the customer experience might suffer if the call to action on the product page isn't adjusted based on the stock level.
Businesses with physical stores could replace the add to cart button with a "find in store" call to action. As a matter of fact, nothing prevents you from showing the "find in store" as a secondary action event if the item is in stock. It would just be the only option if out of stock.
In a "find in store" experience, the customer should be able to select a store from a list or a map, check availability in the selected store, then buy online and pick up in store or schedule an in-person appointment. In cases where you cannot expose the store's stock information on the website, you can opt for an optimistic approach and let customer service handle any product availability issues. Ultimately, it would still be an opportunity for the store to offer alternative products and do some cross-selling.
A "remind me when back in stock" button may also be a nice call to action for out of stock items. Here, the customer should be asked for their email address (if they're not logged in) and join a one-off mailing list. As soon as the item is back in stock, the commerce engine would trigger a "back in stock" email delivery to all subscribers with a link to the product (or variant) page and, optionally, a discount attached.
Option 3: Let the customer decide
A third way would be to add a "show only in stock products" option to the website and let the customers choose, maybe with the option flagged by default. It's basically an addition to option 2 with crawlers being treated like users who want to see everything.
This option requires you to show or hide products dynamically based on customer preferences. Thus, the quantities available for a product must be treated as any other attribute and used as filters on the website. Also in the two other cases, it might actually be better to just store the quantities and use them as filters, rather than physically adding or removing products from the catalog.
By doing so, you can achieve maximum flexibility and easily adapt the logic to changing business needs. Moreover, a dynamic approach allows you to apply different rules to different product types or introduce availability thresholds that allow you to only display an add to cart button if the available stock of a product exceeds a certain level. This types of thresholds are generally used to manage products with limited stock (e.g., luxury goods) that are shared with other channels without being synchronized in real-time.