• Resolved Troels

    (@troelsersking)


    I am not talking about product filter widget!

    I need to have my categories show the products they contain and the subcategories but not the subcategories products.

    I have searched the forum and found a bunch of (old) posts that cover the same issue but I can’t really find a solution.

    For example I have the following category layout.

    Mens Clothing (containing 10 products)
    -> T-shirts (containing 30 products)
    -> Jeans (15 products)

    When I go into “Mens Clothing” I need to get it to display 10 products and two subcategories.

    I dont want 55 products shown.
    I dont want 55 products and two subcategories shown
    I dont want 0 products and two subcategories shown..

    I want products and categories displayed in the categories where they belong, why can’t I figure out how that works it is so simple in Prestashop, Virtuemart and Magento.

    If my desired way to do this is not possible then why?
    Most other systems I tried worked that way and the bahaviour in Woo seems really odd to me but I am new to woo so might be missing something?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Troels

    (@troelsersking)

    I can do it like this and just use the “Mens clotthing” as an empty category.

    Mens Clothing (containing 0 products)
    -> New category (Containing 10 products)
    -> T-shirts (containing 30 products)
    -> Jeans (15 products)

    But the category will show in widget category but not from my menu shop link UNLESS I ad a product to Mens Clothing category.

    Please anyone, what is the normal way to do this in Woo?

    @troelsersking

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.
    
    I can also recommend <a href="https://developer.woocommerce.com/" rel="noopener" target="_blank">the WooCommerce Developer Resources Portal</a> for resources on developing for WooCommerce.
    
    You can also visit the <a href="https://www.facebook.com/groups/advanced.woocommerce/" rel="noopener" target="_blank">WooCommerce Facebook group</a> or the <code>#developers</code> channel of the <a href="https://woocommerce.com/community-slack/" rel="noopener" target="_blank">WooCommerce Community Slack</a>. We're lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.
    Thread Starter Troels

    (@troelsersking)

    @Oyadeyi

    Since Woocommerce doesn’t do categories like I am used to from other webshops I am asking here, since it is the official support site.

    I am just interested in how “best practice” is in regards to organizing subcategories like those I mentioned above.

    Still wondering if it is normal behaviour that a category with only subcategories in it is not shown (needs a product, published dor not)?

    Hi @troelsersking

    The default category display option doesn’t filter out subcategory products. But this is still possible by adding custom code like this: https://stackoverflow.com/questions/26711013/hide-subcategories-products-in-the-macro-category-in-woocommerce

    I tried that code on my test site, and it worked.

    I would recommend using a plugin like?Code Snippets?to add that code to your site.

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

    I think it can easily be done if you have core SEO knowledge. If you want your subcategories to be featured under your main category & under your subcategory, the products will be shown. For instance, https://xyz.com/maincategory/subcategory/product. If this is what you’re looking for them you can create a main category and sub-category from the products option — categories. Each product of you can easily be added there. I did the same thing in one of my online clothing store.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Category & Subcategory’ is closed to new replies.