WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WooCommerce] When on parent catagory show only sub-catagories

[Plugin: WooCommerce] When on parent catagory show only sub-catagories

  • This may not be plugin related but it could be. So I have a parent categoy [Products] and than a few sub-categories what bothers me is when I click on parent category [Producst] I get listed all products from all sub-categories. What I want is that parent category shows only links (preferably with images) to each sub-category and no posts (yet).

    I did find out that under WooCommerce -> Settings -> Catalog there are 2 check boxes which for some reason make no changes to my categories:
    – Show subcategories on category pages
    – When showing subcategories, hide products

    They describe exactly what I need but nothing happens.

    Help will be much appreciated!

Viewing 15 replies - 1 through 15 (of 22 total)
  • I’m having the same problem. Did you figure it out?

    Has anyone figured this out because it seems like the options to hide products for subcategories does not work. Am I missing something?

    Same problem here. I have checked the “When showing subcategories, hide products” in the woocommerce settings but I keep on having the products appearing instead of the subcategories.

    Had anybody managed to resolve that issue.
    The strange thing is that I have not even touched the template files neither I have copied any template files in my woocommerce folder in the theme.

    I believe that there is something goin on with this function
    woocommerce_product_subcategories(); in the archive-product.php but I don’t know how can I make that work.

    Any help will be much appreciated.

    Cheers,
    Nick

    The solution of my problem was:

    I copied the archive-product.php into my template files and I editted the function woocommerce_product_subcategories();

    to be:
    woocommerce_product_subcategories(array(‘force_display’ => true));

    Then I got the subcategories instead of the items.

    Hope that helps!

    I am getting the same problem as above. I have 2 sites using woocommerce, one of which I haven’t update to the latest version, so I suspect its that the causes the problem.

    @nikoza

    I’ve tried to follow you solution, but I’m slightly confused about what file you edited etc. I’ve been into the .archive-product.php file in the woocommerce directory but can’t see any reference to the woocommerce_product_subcategories();

    Any help would be greatly appreciated as this is driving me mad !!! ;o(

    Thanks all

    This is exactly what I did:

    <?php woocommerce_product_subcategories(array(‘force_display’ => true)); ?>

    This function is located in line 55 of the archive-product.php

    Good luck

    I’ve got the exactly same problem.
    The “force_display” method works for me, it shows the sub categories now.
    But it doesn’t hide the products, so the problem remain.

    I want to realize this kind of hierachy :
    – Home (no products)
    — Category ‘cat1’ (shows only sub categories of ‘cat1’ = ‘sub1’ & ‘sub2’)
    — Sub category ‘sub1’ (shows only products of ‘sub1’)
    — Sub category ‘sub2’ (shows only products of ‘sub2’)

    Is it possible in any way?
    Thank you.

    Hi,

    Did you find the solution to hide products is the category has sub-categories?

    Many thanks!

    Anyone ever figure this problem out?

    I am also having this problem, and it looks like from the age of this post this has been ignored or overseen. Is there a way we can forward this thread to the WC team? Obviously something is not working as it should. Resorting to code hacks to enable intended functionality is not ideal.

    also having this problem. also not confident to change code in case i mess things up

    Anyone have success with this yet (beside editing the php)? Has anyone tried the default WP theme? I tried twenty twelve and twenty ten with no success.


    Both

    “Shop Page Display”
    “Default Category Display “

    are set to “show subcategories”

    I’ve tied using these shortcode in a page.

    [product_category category="parent-slug"]

    [product_category category="subcat-1-slug, subcat-2-slug, subcat-3-slug, subcat-4-slug"]

    [product_categories number="subcat-1-slug, subcat-2-slug, subcat-3-slug, subcat-4-slug,"]

    [product_categories number="subcat-1-number, subcat-2-number, subcat-3-number,subcat-4-number"]
    This one worked to show subcategories, but after the subs all the other categories displayed.

    [product_category category=subcat-1-number, subcat-2-number, subcat-3-number,subcat-4-number"]
    Blank – No results

    Anyone else using a shortcode on a page, instead of the archive page?

    For now I’m going to use, [product_categories number="subcat-1-number, subcat-2-number, ssubcat-3-number,subcat-4-number"] , and just deal with it. However, this is a flaw because if I add a new subcategories then I’ll have to add that subcat number to the shortcode.

    There is a setting under Products >> Categories >> Display Type and the options are “Display, Products, Subcategories, Both”

    I’ve tried all different ways and still have not succeed. There is nothing in the docs about this setting (yet).

    I know woo is updating their docs now. And perhaps they will shed more light on this and their shortcodes.

    If you are watching,
    @coen Jacobs
    @jameskoster
    @mikejolley
    @woothemes

    Can you chime in? 13 responses and 8 months old.

    Thank you for a great product.

    @jameskoster

    Both
    “Shop Page Display”
    “Default Category Display “

    are set to “show subcategories”

    It’s working fine for me?

    Are you running the latest version of WooCommerce? And which theme are you using?

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘[Plugin: WooCommerce] When on parent catagory show only sub-catagories’ is closed to new replies.
Skip to toolbar