Learn in this tutorial how to hide WooCommerce products that do not have featured image from search results using code.
By default, when the web visitor performs a search all WooCommerce products appear but you may prefer to hide the ones without featured image
Interested? Here’s how to do it.
Snippet to hide WooCommerce products without featured image from results
Add the following code at the end of functions.php or in your functionality plugin:
In this code you use the hook
pre_get_posts in combination conditional tags and the
As you can see, with a few lines of code you can hide WooCommerce product search results without featured image.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂