WooCommerce out of stock products can be excluded from search result by using the _stock_status meta key of products. This meta key checks if a product is in stock or not. We can modify search query using pre_get_posts action hook and load only instock products. Code goes in the functions.php… Read More »