Skip Navigation

[Resolved] WooCommerce category description

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can I display or pull data from the descriptions of WooCommerce's taxonomy product categories?

Solution:
https://toolset.com/forums/topic/add-woocommerce-product-category-description-to-a-layout/#post-823348

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by taih 6 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#818432

I am trying to add the category description text from a woocommerce product category to a layout. Here's the development site for reference hidden link
I popped in a placeholder for now [wpv-woo-productcategory-description]

cheers,

#823348

It seems that this is accessible as described here on the WooCommerce Documentation page:
hidden link
hidden link

$cat_id=$category->term_id;
$prod_term=get_term($cat_id,'product_cat');
$description=$prod_term->description;

There are other tutorials as well:
hidden link
hidden link

If you return this in a ShortCode you should be able to output it anywhere afterwards.

But you should as well be able to get this data from native Toolset ShortCodes:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-description
https://toolset.com/forums/topic/woocommerce-taxonomy-description/
https://toolset.com/forums/topic/display-woocommerce-product-select-by-taxonomy-custom-on-a-wordpress-page/
Just, this works only on a Taxonomy View or Taxonomy Archive - no matter if used in a Layout or not.

Again, as well there are other approaches you can take, but they involve Custom Code:
https://toolset.com/forums/topic/how-to-display-woocommerce-product-categories-image-in-views/

#846666

Thank you for the comprehensive answer with different approaches!

as always, you rock!

#916781

I am still having a bit of trouble with displaying the woo commerce category description. I have created a layout and a view within that to display the category description, per your advice.

It seems to work on some pages: hidden link
But not on others, this page shows a parent description (from /womens_clothing/), not of the current category:
hidden link

the view settings are:
Content Selection: Taxonomy>Product Categories
Display:1
Query Filter: Taxonomy term filter
Taxonomy is set by the current post
Loop: [wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-taxonomy-description]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"][/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

I am stumped, any direction would be welcomed. Thanks a bunch.

Edit*
I just noticed the infobar saying I should open a new ticket..oops, opening new ticket now.