It can happen. And it’s embarrassing. A visitor searches your site for a product and whatever their search terms are, no products are found. Instead of a missed opportunity to convert that visitor into a paying customer, consider showing them some products that might be of interest to them.
If a customer can’t find a product as part of their search, how can I display products the might be interested in?
In this tutorial we’ll show you how to show your featured products as products that might be of interest to your visitors when search fails.
WordPress Code Warning:
This article features code changes, or snippets, that you can make in your active themes function.php file. If you are unfamiliar with this task, or want to brush up, we have an article on Managing code snippets in WooCommerce. The technique provided can be used for both WordPress and WooCommerce sites.
This is a super simple solution that involves just a little bit of code. Open up your theme’s functions.php file and add the following function.
You can change the “per_page” number to show more or less products depending on how many features products you have.