This is Elias with Shopify Support. I'd be happy to lend a hand with this!
I understand you're looking for a way to disable products from the Online store and Facebook sales channel when they are out-of-stock. Though there isn't a way to do this automatically, you can enable inventory tracking to stop selling the products when they run of stock. It's also important to note that "continue selling when out of stock" shouldn't be enabled to prevent overselling.
If you want to stop the products from appearing in the Online store and Facebook, you can remove the products by managing your product's availability. However, there isn't a way to automate this step. Though this is essentially hiding the products from these two sales channels, otherwise the other option is to delete the product. If you need to manage the availability for multiple products, you can use the bulk editor to manage up to 50 products per page. From there, you can add the properties for each sales channels and edit them in bulk.
Let me know if this is what you're looking for?