Hide “No products were found matching your selection” on shop page
-
Hello
I want to Hide “No products were found matching your selection” on shop page.
But if I use this code will be remove search product too.
add_action( ‘woocommerce_product_query’, ‘prefix_custom_pre_get_posts_query’ );
/**- Hide Product Cateories from targetted pages in WooCommerce
- @link https://gist.github.com/stuartduff/bd149e81d80291a16d4d3968e68eb9f8#file-wc-exclude-product-category-from-shop-page-php
*
*/
function prefix_custom_pre_get_posts_query( $q ) { if( is_shop() || is_page(‘shop’) ) { // set conditions here
$tax_query = (array) $q->get( ‘tax_query’ );$tax_query[] = array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array( 'earrings','ring'), // set product categories here 'operator' => 'NOT IN' ); $q->set( 'tax_query', $tax_query );
}
}
Even when I search for products, Regardless of whether there are matching products, they will not be displayed, there will be no prompt box, and no matching products will appear.
I would like to ask if there is any way to delete only the prompt box on the shop page.
Because I want to match woocomerce’s product wheels
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Hide “No products were found matching your selection” on shop page’ is closed to new replies.