just add the following code to functions.php of active theme.
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>';
}
Thread Starter
bene25
(@bene25)
@mdshak Thanks, this helps. But I want to display custom field value for specific cetegory by using this plugin:
https://ru.wordpress.org/plugins/advanced-custom-fields/
I have added and filled this field:
View post on imgur.com
But couldnt display it in categories blocks
-
This reply was modified 7 years, 7 months ago by
bene25.
Thread Starter
bene25
(@bene25)
@mdshak I saw this article, but there are last two questions in this article without reply. I want do the same.
I am having the same problem as Michele. I only want the category description to display on the category pages and not the shop page. I will be most grateful for any tips on how to resolve it.
Great article by the way!
To Display the description at category pages only. Just use the following code.
<?php
if(is_product_category()){
//show category description
$term_object = get_queried_object();
?>
<div class="woocommerce-category-description">
<div class="title"><?php echo $term_object->name; ?></div>
<div class="description"><?php echo $term_object->description; ?></div>
</div>
<?php } ?>
Thread Starter
bene25
(@bene25)
@mdshak doesnt help, nothing changed at all.
I added code to archive-product.php after
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
as described here
-
This reply was modified 7 years, 7 months ago by
bene25.
Thread Starter
bene25
(@bene25)
Hi @bene25,
Yeah you asked in the right place – hopefully someone will reply soon. I am going to mark this as resolved here because it’s not really a question for us.
@bene25 – Please share the shop page URL and product category page URL.
Thread Starter
bene25
(@bene25)
Shop page URL is https://viveska911.com.ua/produkcyia/
And I use product categories for shop page.
And I want to make like this
View post on imgur.com
Thanks!