You have the ability to have a product removed automatically whenever it sells out on your website. You can set up an automated collection to handle this for you instead of doing it manually for each product.
Step 1: Select the “Collections” option from the “Products” menu.
Step 2: Select the collection to automate.
Step 3: Make changes to the conditions to ensure that the “Inventory Stock” is greater than or equal to zero.
Because of these parameters, no products in your automated collection will have zero inventory. Your out-of-stock products will therefore be hidden by default.
Note: This won’t work unless you enable inventory tracking.