Support » Plugin: WooCommerce » Display product category description within product category loop

  • mizukimadness

    (@mizukimadness)


    Hello!

    I’m currently developing a Storefront child theme. My problem is not affected by Storefront, though.

    On my shop’s front page, I display all my product categories. However, below the title, I want to display the product category description.

    How do I do this? I want to create a function within my child theme’s functions.php rather than create my own template, if possible.

    Best wishes,
    Erika

Viewing 2 replies - 1 through 2 (of 2 total)
  • lorro

    (@lorro)

    Try this:

    
      add_action( 'woocommerce_after_subcategory_title', 'show_cat_description', 12);
      function show_cat_description ($category) {
        $cat_id = $category->term_id;
        $prod_term = get_term($cat_id, 'product_cat');
        $description = $prod_term->description;
        echo '<div class="shop_cat_desc">'.$description.'</div>';
      }
    
    Thread Starter mizukimadness

    (@mizukimadness)

    Thank you!

    Passing the $category variable did the trick.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display product category description within product category loop’ is closed to new replies.