Simple steps to enable stock alert function in Magento 2 default: Step 1:In order to enable the stock alert function of Magento 2, you need to enable displaying out of stock product first.
Go to Stores > Configuration > Catalog > Inventory > Stock Options.
Display Out of Stock Products: Choose Yes to enable displaying out of stock products in the frontend.
Step 2:Go to Stores > Configuration > Catalog > Catalog > Product Alerts.
Allow Alert When Products Come Back in Stock: choose Yes to enable stock alert.
Step 3:Stock Alert Email Template: choose the template to apply for product stock alert email.
Step 4:Alert Email Sender: select the store contact as the sender of the stock notification email.
Step 5:Save configuration.
In case you want more advanced stock alert functions than the default such as allow stock alert for not-logged-in customer, stock alert for child product of configurable product…, BSSCommerce has developed
Out of Stock Notification for Magento 2 extension.FREE INSTALLATION FOR ANY PURCHASEMagento 2 Extensions Best