Last active
May 28, 2021 14:22
-
-
Save UraraReika/98bfcc2ae6863108778bddc0dde9b80c to your computer and use it in GitHub Desktop.
Handling products not found messages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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