1
votes

I've tried adding <?php do_action('woocommerce_archive_description'); ?> to content-single-product.php template file, but it's not showing up.

Is there any way to add the WooCommerce category description to single product page?

2

2 Answers

3
votes

To add category description to single product page, using content-single-product.php template file, this code did the trick:

<?php 

    global $post;
    $args = array( 'taxonomy' => 'product_cat',);
    $terms = wp_get_post_terms($post->ID,'product_cat', $args);
    $count = count($terms); 
    if ($count > 0) {
        foreach ($terms as $term) {
            echo '<div>';
            echo $term->description;
            echo '</div>';
        }
    }

?>   
0
votes

You can use this code to display the product category description to single product page -

<?php global $post, $product;
$categ = $product->get_categories();
$term = get_term_by ( 'name' , strip_tags($categ), 'product_cat' );
echo $term->description; ?>