To hide out of stock products in WooCommerce, just follow these steps:
Step 1. WooCommerce > Settings
Step 2. Products > Inventory
Step 3. Hide out of stock items from the catalog > Save changes
If you have problems, don’t hesitate to send me. I will reply in 1-2 days.