Subcategories woocommerce (4 posts)

  1. Robinero
    Posted 3 years ago #

    Hey there!

    I was wondering if it's possible to show a product's subcategories of a (main)category.

    I have a category called Producers, which is filled with subcategories like PRO1, PRO2 and PRO3.

    On a product page I would like to show the Producers linked to that specific product. Like PRO1 for example.

    Now this is easy to do if I have only 1 category, however I have more categories besides Producers (Artists etc).

    Does anyone know if this is possible?

    Thanks in advance!


  2. IgniteWoo Team
    Posted 3 years ago #

    Could add some code to your templates that use the wp_get_post_terms() function to get the list of categories and display them. The taxonomy name for product categories is product_cat. See the Codex for help on using that function:


  3. Robinero
    Posted 3 years ago #

    It is kind off what I'm looking for, however I still cannot figure out how to actually extract subcategories from a main category (in this case Producers).

    This is what I got so far, $product being global from woocommerce.

    get_the_terms( $post->ID, 'product_cat' );
    echo $product->get_categories();
  4. Robinero
    Posted 3 years ago #

    Is there any way of doing this in WordPress way?
    Seeing as these lines are just picked up from WordPress.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.