Hi
Go to Woocommerce → Settings and click the Products tab
Click the Inventory link at the top
Check the Out Of Stock Visibility option to hide out of stock items
Note:- If stock management is enabled at parent level, it will not consider all of the child stock levels if those are enabled also. If you’re managing stock levels per variation the parent level should not be set nor enabled, then it will respect the levels and stock statuses of the variations themselves.