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.

9
Leave a Reply

avatar
6 Comment threads
3 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
ViktorKareniacopoJoeJohnPaulie Recent comment authors
  Subscribe  
Notify of
jknorpp
Guest

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!

caio
Guest

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
Guest

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

iacopo
Guest
iacopo

Thanks, this code works! Really simple to use

Karen
Guest
Karen

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
Guest
Viktor

Thank You, good man!!!