How to display WooCommerce Product Category Description

Displaying Woocommerce Product Category description is necessary for SEO purpose or for better customer understanding about the product category before making any purchase.

Category description should be displayed under category title on woocommerce category shop page. Below is the screenshot for WooCommerce products on Product Category “WooCommerce” category page:

How to display WooCommerce Product Category Description

How to display WooCommerce Product Category Description

Step 1: Open functions.php in your theme folder.

Step 2: Add the following code in 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>';
}

Step 3: Save the file and you can go to any category page on your WooCommerce store and see the result.

0 0 vote
Article Rating
Subscribe
Notify of
guest
9 Comments
Inline Feedbacks
View all comments
jknorpp
4 years ago

Hi Ricky,

thanks for the tutorial.
I wonder though, how one could show the category-description only on an opened category-page under the category-title of that page and not under the list (or grid) of categories shown on the shop page for example (or for subcategories listed on a category page)?

Do you have any idea?
Thanks for a hint!

Joe
Joe
4 years ago
Reply to  Ricky1990

I am trying to do the same thing, I’ve got woo commerce installed with the theme Chandelier they won’t help me to do this, but I can’t find the file taxonomy-product_cat.php the part at the top is working and it now shows the description below categories on the shop page, but I’m not using that page, I’ve added links direct to specific categories, so I need the descriptions for each category to show on that category page.

(im also trying to do the same with Product-tag descriptions, get them to show the relevant product-tag page) Can you please help?

caio
4 years ago

Hello,

I’m a newby in php. I’m using wp all export to export information from my woocommerce. They have an option to export the category exporting the value returned by a PHP function, and the value I have to return is the product category description.

I’ve inserted your code in a custom functions file that I have created but the code only shows the description in my site, but I can’t call the function to get the category description.

I’m not interested on showing it in my site, but only to create the function to be called from wp all export in order to export the description value of each category.

Could you help me please??

JohnPaulie
4 years ago

I use the code and it works perfectly. Thanks a bunch!

iacopo
iacopo
3 years ago

Thanks, this code works! Really simple to use

Karen
Karen
3 years ago

Hi there!! The above snippet is brilliants!! I’m using genesis with woocommerce and I have a question…. hoping you can help me out 😉

The above code is great however if you have a super long description, how would I add a “Read More” button to shorten the description to say 20 words???

Many thanks!!!

Viktor
Viktor
2 years ago

Thank You, good man!!!

9
0
Would love your thoughts, please comment.x
()
x