You can automatically hide sold-out products in a collection by using Shopify’s built-in collection rules. No additional apps are required.
This method works when the collection type is Smart.
Steps
Go to Shopify Admin → Products → Collections.
Create a new collection or edit an existing one.
In Collection type, select Smart.
Add the rule:
Inventory stock → is greater than → 0
Save the collection.
After this rule is applied, any product that becomes sold out (inventory = 0) will automatically be removed from that collection. When the product is restocked, it will appear in the collection again automatically.

Notes
This works only with Smart collections.
If you are using a Manual collection, you will need to remove sold-out products manually or use an app to automate this behavior.
