Home Forums Smarty – Education WordPress Theme Show woocommerce category description under category title

This topic contains 1 reply, has 2 voices, and was last updated by  Baxter 10 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3491

    I can usually figure this out on my own but I’m having trouble adding a filter or hook to make the category description show under the category title. I’ve tried various code snippets that work on other themes/storefronts, but they don’t work on the Smarty theme. Any suggestions in pointing me in the right direction to get the woocommerce category description to show?

    Thanks
    Chris Blair

    #3542

    Baxter
    Keymaster

    Hi,

    In order to realize your needs:

    1. Please install and activate Child theme.
    2. Add the following code in Child functions.php:
      add_action( 'woocommerce_after_subcategory_title', 'custom_add_product_description', 12);
      function custom_add_product_description ($category) {
      $cat_id        =    $category->term_id;
      $prod_term    =    get_term($cat_id,'product_cat');
      $description=    $prod_term->description;
      
      echo '<div>'.$description.'</div>';
      }
    3. Save the file and you can go to any category page on your WooCommerce store and see the result.

    Regards

    • This reply was modified 10 months, 1 week ago by  Baxter.
    • This reply was modified 10 months, 1 week ago by  Baxter.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.