The way to automatically hide out of stock products is through automatic collections which you may have already set up.
Automatic collections work based on conditions, so if you’re tracking stock for your products you need to make sure to add a condition to each collection that says inventory stock is greater than 0: