Woocommerce no result page not able to show featured products

In storefront theme, for no result in search page , I would like to show featured products in that view. So in /storefront/woocommerce/loop/no-product-found.php, ive added this code

<div class="site-main">

<?php echo do_shortcode('[products per_page="10" columns="3"]')?>

So when i search for something like "shoes",I was hoping wordpress to show no results and then goes on showing the featured products. However, I'm not able to show the featured products. When I check the query, its partly due to the page is in search where there is a query searching for the product name which is "shoes". Is there a way to exclude that in any queries for search page? If that makes any sense


The shortcode you tried to use is incorrect.

The shortcode for featured products is:

echo do_shortcode('[featured_products limit="3"]');

Note: you could also pass it a limit.

woocommerce shortcodesDocs

Other related shortcodes:

For products on sale:

echo do_shortcode('[sale_products]');

For popular products:

echo do_shortcode('[best_selling_products]');

For top rated products:

echo do_shortcode('[top_rated_products]');

For recent products:

echo do_shortcode('[recent_products]');

Since you're using storefront theme, it has a 404 page which shows featured products and Popular Products etc. by default! You don't have to change/modify any of its templates. However, if you're overridding storefront with woocommerce templates then you could go ahead and manipulate any template you want using the shortcodes i just gave you!

Similar questions

Search result count not matching actual result
I have a custom search in place where I've excluded posts that have a custom field with a specific value, but the search count is including those with the custom field value. How can I get the search count to match the actual number of results? EDIT: I tried since to get the count with a sql statement. The results are always the same number of post...
Featured Images are not able to be set
I've tried a few solutions I found online on this site and many others, but most issues are with theme users and not theme developers. There is a issue with my theme that I am building it is not setting Featured Image/Thumbnail in any type of template meaning pages, post, etc... I also can't remove ones that I preset manually! I also noticed if I c...
Not able to pull in featured image
I'm using a wordpress theme as a base to provide horizontal parallax scrolling. I have everything working wonderfully, but when I try to pull the featured image into the page (see CONTENT), nothing will pull up. I can get a static image to show up, but not with any amount of tags or even custom fields. Here is the code for the page: Thanks!
Custom Search Result Page displaying only 1 result.
I'm trying to build a custom search results page. The problem I'm running into is that when I enter a search term ; say 'gaming', it will only return one result, being the latest result. I have my blog setup to display only one article at a time. However, I found a way to circumvent the search results page by logging into wp-admin -> settings -> re...
Search result page - display values from the result's metaboxes
i have this custom search-result page the search results i am expecting will have custom fields for image and description , with the fields having different IDs depending on which page this result is from, i am having a problem figure out the correct code to pull out values from those custom fields. working fine because it is more of a generic func...
Result of Custom WP_Query appears on 404 Page (but result are found!)
I wrote a custom search page. It was working well then I added additional changes, now I got 404-Result-problem. The problem keep there even I did revert (I have backup) and I cleared the cache. I'm not sure if it's because of Wordpress update i ran today. So I want to find out what wrong here since I don't know why I got "404 Not Found"-Page with ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.