Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there,

    This will be possible using the [product_categories] shortcode, and the parent attribute. The description of the attribute mentions you can set it to the ID of a category to show all the subcategories for that parent. However the description doesn’t mention that you can set it to 0 to show only the top-level categories. I am going to reach out to the documentation team internally to make sure we add that.

    It is currently mentioned in the first example in that section — something like [product_categories parent="0"] should give just the parent categories:
    https://docs.woocommerce.com/document/woocommerce-shortcodes/#scenario-8-show-top-level-categories-only

    I hope that helps!

    Thread Starter krishs

    (@krishs)

    Hey @kellymetal

    Thanks for the quick response. It works for me.

    but what if i want to display all the parent categories but want to hide one specific category? Is that possible with any shortcode?

    Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there,

    Glad to hear that worked.

    To hide one specific category, I think the easiest way would be to instead use the ids attribute and list out the ids of the categories that you want to display. For example: [product_categories ids="16, 17, 18, 19, 20, 21"]

    Thread Starter krishs

    (@krishs)

    Cool! thanks a ton…:)

    Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there,

    You’re welcome a ton! : )

    I’m going to mark this thread as resolved. If you have any further questions, please start a new thread.

    Have a wonderful day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘display parent product category’ is closed to new replies.