Skip to content

Instantly share code, notes, and snippets.

@lwgists
Forked from ajmorris/functions.php
Last active January 16, 2018 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lwgists/f9b7a60f02a046652817f8d545357feb to your computer and use it in GitHub Desktop.
Save lwgists/f9b7a60f02a046652817f8d545357feb to your computer and use it in GitHub Desktop.
When no WooCommerce products are found, show the visitor your features products
<?php
add_action( 'woocommerce_no_products_found', 'show_featured_products_on_no_products_found', 20 );
function show_featured_products_on_no_products_found() {
echo '<h2>' . __( 'You may be interested in...', 'domain' ) . '</h2>';
echo do_shortcode( '[featured_products per_page="4"]' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment