Support » Plugin: WooCommerce » Display Category Description on Shop page

  • I have my main Woocommerce Shop Page/Product Archive set to ‘show subcategories’. By default Woocommerce only displays the following on the Shop page:
    Category Image
    Category Title
    Category item count

    Can anyone advise how I get the Category Description to show up, either via functions.php or a modification to the relevant Woocommerce page (copied to my theme)?

    On further inspection it seems that I need to add something to ‘content-product_cat.php’.

    Looking at ‘archive-product.php’ I would have thought that copying the following code into ‘content-product_cat.php’ would do it but it makes no difference:

    <?php do_action( 'woocommerce_archive_description' ); ?>

    I’ve also tried the following code in my ‘functions.php’ file :

    add_action('woocommerce_after_subcategory_title','add_cat_desc', 5);
    function add_cat_desc() {
    echo "
    <?php do_action( 'woocommerce_archive_description' ); ?>
    ";
    }

    but when I view the source for the shop page, the php line is commented out, instead of being executed.

    Any help very much appreciated, and sorry in advance for my PHP ignorance!

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey mate, any luck with this?
    Did you find any workaround?
    I’m looking for the same result.

    Cheers!

    Unfortunately not. Lucky for me, client decided they didn’t want to display the description anyway. Good luck and be sure to post here if you find the solution.

    Try adding the following to ‘content-product_cat.php’

    echo $category->description;

    Good work and thank you IstanbulMMV – that does indeed work!

    I also just discovered that my original post over on the WooThemes forum had also been answered with a working snippet to add to functions.php.
    Here’s the code, courtesy of ‘Anna Marie’:

    //Display product category descriptions under category image/title on woocommerce shop page */
    
    add_action( 'woocommerce_after_subcategory_title', 'my_add_cat_description', 12);
    function my_add_cat_description ($category) {
    $cat_id=$category->term_id;
    $prod_term=get_term($cat_id,'product_cat');
    $description=$prod_term->description;
    echo '<div class="shop_cat_desc">'.$description.'</div>';
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display Category Description on Shop page’ is closed to new replies.