This topic has 3 replies, 2 voices, and was last updated 9 years by sharmstr.

  • Author
  • #47629
     bkozlowski
    Participant

    Hello,

    I’m having a really hard time excluding a category from the “woocommerce product categories widget”. I should just be able to drop this code into functions.php, but for some reason it’s conflicting with something.

    Please advise…

    COPY CODE
    add_filter( 'woocommerce_product_categories_widget_args', 'exclude_product_cat_widget' );
    
    function exclude_product_cat_widget( $args ) {
    	
    	$args['exclude'] = array('16','46');
    	
    	return $args;
    }

    or…

    COPY CODE
    add_filter( 'woocommerce_product_categories_widget_args', 'woo_product_cat_widget_args' );
    function woo_product_cat_widget_args( $cat_args ) {
        $cat_args['exclude'] = array('16');
        return $cat_args;
    }
    #47631
     sharmstr
    Moderator

    I think you’re right about the conflict, but its not with Kleo. I copied your code and it works perfectly for me. Its probably with some other woo plugin you have installed.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #47826
     bkozlowski
    Participant

    I’ve tried loading a fresh copy of KLEO and am still having the problem. It appears the categories are being excluded when the widget is set in the “primary” sidebar. When I add the widget to the “Shop” sidebar I am having the problem.

    I think it has something to do with the lib/woo-commerce-plugin/config.php ?

    Please advise.

    Thanks!

    #47848
     sharmstr
    Moderator

    Again. It works for me. No problem in Shop Sidebar.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

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

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?