If you do not want articles without stock to be visible in the shop, you can do this by a simple setting in the basic settings menu in the Storefront category.
Basic settings >Storefront >Shopping cart/Article details > Deactivate sales articles without stock: Set to yes!
The sales setting for the respective article can be adjusted here:
Article > Overview > Edit article > Master data
Über den Autor