Nobody is exempt from cases when a certain product runs out of stock. But still, your customers may be genuinely interested in purchasing a corresponding item. Thus, you need to work this around somehow.
One option is to enable backorders. Yet, you can also configure Magento 2 back-in-stock notifications. They make it possible for your customers to sign up for the products they intend to purchase. Then they'll receive notifications when the desired item is available again.
Sounds promising, doesn't it? And these notifications are exactly what you'll learn to set up today.
To configure back-in-stock notifications in Magento 2:
1. Go to Stores > Settings >Configuration > Catalog > Inventory and unfold the Stock Options section.
2. Choose Yes in the Display Out of Stock Products field.
3. Navigate to Stores > Settings > Configuration > Catalog > Catalog and open the Product Alerts section.
4. Allow Alert When Product Comes Back in Stock by selecting Yes in the corresponding field.
5. Move to the Product Alerts Run Settings section.
6. Set the Frequency and Start Time for the back-in-stock notifications.
Don't forget to Save the settings and check the results on the frontend.
You'll need just a few minutes to complete these settings. However, constant out-of-stock situations are not exactly the best for customer experience. Not all customers might be willing to wait.
That's why you also need to enable the low stock notifications to know about the inventory shortages in advance and enhance the stock management in your store.