• Resolved sty.vasilakakis

    (@styvasilakakis)


    Hi, we used to use this code

    /* Enter your custom functions here */
    function exclude_product_cat_children($wp_query) {
    if ( isset ( $wp_query->query_vars[‘product_cat’] ) && $wp_query->is_main_query()) {
    $wp_query->set(‘tax_query’, array(
    array (
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $wp_query->query_vars[‘product_cat’],
    ‘include_children’ => false
    )
    )
    );
    }
    }
    add_filter(‘pre_get_posts’, ‘exclude_product_cat_children’);

    add_filter( ‘woocommerce_subcategory_count_html’, ‘jk_hide_category_count’ );
    function jk_hide_category_count() {
    // No count
    }

    To show products only in the category they were in and not in the parent while showing categories in the shop too.
    With the recent changes Woocommerce did that code doesn’t work.
    Anyone know how we can do what we want now?

    (excuse my english)
    Thanks in advance
    Stylianos

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter sty.vasilakakis

    (@styvasilakakis)

    Noone knows? I don’t really know any coding (found the above code from searching).

    Any solutions?

    Thanks in advance
    Stylianos

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    Stylianos,

    The relevant settings for this are now within the Customizer. Go to Appearance->Customize->WooCommerce->Product Catalog.

    If you need to customize it further you would need to create your own customization.

    Thread Starter sty.vasilakakis

    (@styvasilakakis)

    Thomas
    Thank you for taking the time to respond.
    I will look it up.

    Have a good day ??

    Plugin Support Ryan Ray, a11n

    (@ryanr14)

    Hi there,

    Glad Thomas could help. Hopefully, that new customizer option is what you were after.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Products and Categories’ is closed to new replies.