Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save UraraReika/98bfcc2ae6863108778bddc0dde9b80c to your computer and use it in GitHub Desktop.
Save UraraReika/98bfcc2ae6863108778bddc0dde9b80c to your computer and use it in GitHub Desktop.
Handling products not found messages.
<?php
add_filter( 'jet-woo-builder/shortcodes/jet-woo-products/not-found-message', '__your_theme_prefix_set_custom_not_found_message', 10, 2 );
function __your_theme_prefix_set_custom_not_found_message( $message, $object ) {
$query = $object->query();
if ( $query->get( 'jet_smart_filters' ) === jet_smart_filters()->render->request_provider( 'raw' ) && ! $query->have_posts() ) {
$message = 'Your filter settings do not return a match. Please choose other options'; // for smart filters
} elseif ( ! $query->have_posts() ) {
$message = 'No products in this category'; // other situations
}
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment