Home Forums Basel support forum Product filters not working

Product filters not working

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8208

    shadyrad
    Participant

    Hello,

    I was using filters in sidebar (BASEL – Woocommerce Layered Nav widgets). It worked, but some time ago I noticed they stopped working (did not filter the products). I disabled them. Today I tried to find out, why they dont work and found out no filters (BASEL – Woocommerce Layered Nav widget, Woocommerce native layered nav widgets, YITH AJAX filter) work for me with your theme (i also checked the parent theme without my changes). However, price filters including BASEL – price filter do work. When I switch to another theme, filters do work (of course there is not the BASEL – Woocommerce Layered Nav widgets, but other filters work). Thank you for your help.

    Radim

    #8215

    Artem Temos
    Keymaster

    Hello,

    Thank you so much for contacting our support center.

    Please, provide your admin access so we could check everything ourselves. Thank you.

    Kind Regards
    XTemos Studio

    #8801

    shadyrad
    Participant

    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

    #8820

    Artem Temos
    Keymaster

    Hello,

    We are glad that you have found a solution!

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Product filters not working’ is closed to new replies.