WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Only show subcategories and products of current category? (2 posts)

  1. thundermarketing
    Member
    Posted 1 year ago #

    In the WooCommerce settings, if you uncheck "When showing subcategories, hide products" it shows all products underneath that category, even under any of the current sub-level categories.

    I need a variant of that—is there a way to only show products of the *current category* but not any of the subcategories?

    For example, if I'm currently browsing Subcategory A, right now it shows:

    Main Category
    * Subcategory A
    * * Subcategory B
    * * Subcategory C
    * Products of Subcategory A
    * Products of Subcategory B
    * Products of Subcategory C

    We'd like it to show:

    Main Category
    * Subcategory A
    * * Subcategory B
    * * Subcategory C
    * Products of Subcategory A

    Especially when you're on Main Category, it shows all products underneath that category as well as any subcategories. I just need subcategories.

    I don't have any products underneath the Main Category so it shouldn't display any products.

    I made a copy of archive-product.php and woocommerce_product_subcategories() so I could experiment but at a loss as to what to change the wp_query to only query products in the current category (but not any of the children).

    Thanks,

    Dave

    http://wordpress.org/extend/plugins/woocommerce/

  2. KingRosales
    Member
    Posted 1 year ago #

    I have the same inquiry. I think its really strange that by default it displays all of them on the parent categories especially on the homepage.

    Someone from woocommerce is looking into this right now, I will update this if I get a solution.

    thanks,

    King

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic