Forums Forums Search & Filter Pro Exclude IDs not working in WooCommerce results

Viewing 9 posts - 1 through 9 (of 9 total)
  • Anonymous
    #184682

    I have a S&F WooCommerce search form and have excluded certain product categories. This removes them from the filtering but the product category thumbnails still show for 2 of the excluded categories.

    I have tried to exclude them in the with the Advanced settings for the Taxonomy and also in the Tags, Categories & Taxonomies tab (globally). Neither removes the two category thumbnails.

    Anonymous
    #184683
    This reply has been marked as private.
    Trevor
    #184688
    This reply has been marked as private.
    Anonymous
    #184698
    This reply has been marked as private.
    Trevor
    #184772

    I think I see. When you do an actual search, these do not show, just on the shop ‘Categories’ page?

    Anonymous
    #184815

    Yep, that’s correct. This is hosted on WP Engine by the way which has its own caching but I’ve emptied the cache over and over.

    Trevor
    #184849

    Hi

    The actual display of the category tiles is a separate query from ours, so our filter does not affect it. I excluded the categories from the search, so that works, but you will need to find a hook in WooCommerce to exclude the categories from that category grid. Something like this maybe:

    https://www.engagewp.com/remove-categories-woocommerce-product-category-widget/

    Anonymous
    #184891

    Okay, got it. Didn’t realise S&F wasn’t doing the query at that stage.

    For anyone else looking for this, this is what worked in the end.

    /**
     * Hide Categories from WooCommerce Shop Page
     */
     
    
    add_filter( 'woocommerce_product_subcategories_args', 'custom_woocommerce_product_subcategories_args' );				
    
    function custom_woocommerce_product_subcategories_args( $args ) {		  
    	$args['exclude'] = array('139','140', '132', '331', '330'); // Insert the product category IDs you wish to exclude	  
    	return $args;		
    }

    Based on this: https://mikejolley.com/2018/02/07/woocommerce-3-3-hide-uncategorized-category-from-the-shop-page-on-the-frontend/

    Trevor
    #184901

    Thanks for sharing. I will mark this thread as closed for now.

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