computer c code

Easy way to improve the “No products found” page in WooCommerce.

An easy to change this page is by hooks and filters. One example is to show featured products, plus a slider at the top (after the no products found message). You can see the shortcode (replace with your own). This has been modified from cssigniter


add_action( 'woocommerce_no_products_found', 'cssigniter_show_featured_on_no_products_found', 15 );
function cssigniter_show_featured_on_no_products_found() {
	?>
	<?php
echo do_shortcode('[smartslider3 slider="44"]');
?>
	<div class="search-featured-wrapper">

		<h3><?php esc_html_e( 'Featured Products', 'your-text-domain' ); ?></h3>
		<?php echo do_shortcode( '[products limit="6" columns="3" visibility="featured" orderby="rand"]'); ?>
	</div>
	<?php
}