Quantcast
Channel: XTemos » All Posts
Viewing all articles
Browse latest Browse all 39749

Reply To: Product filters not working

$
0
0

Hello,

thank you for your offer. When I finally managed to set up staging server, I found out that your theme worked and the problem was my child theme. I found out it was this piece of code:

add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );

function custom_pre_get_posts_query( $q ) {

	if ( ! $q->is_main_query() ) return;
	if ( ! $q->is_post_type_archive() ) return;
	
	if ( ! is_admin() && is_shop() ) {

		$q->set( 'tax_query', array(array(
			'taxonomy' => 'product_cat',
			'field' => 'slug',
			'terms' => array( 'prirodni-kosmetika'), // Don't display products in the knives category on the shop page
			'operator' => 'NOT IN'
		)));
	
	}

	remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );

}

that was removing certain category from main shop page.

Best Regards
Radim


Viewing all articles
Browse latest Browse all 39749

Trending Articles