You can add a WooCommerce products’ long or short description to the actual product on the main shop page in WooCommerce via the woocommerce_after_shop_loop_item_title action hook, this hook places content immediately after the product title.

Adding the Long Description to the Product Loop on the Shop page

add_action( 'woocommerce_after_shop_loop_item_title', 'wc_add_long_description' );
/**
 * WooCommerce, Add Long Description to Products on Shop Page
 *
 * @link https://wpbeaches.com/woocommerce-add-short-or-long-description-to-products-on-shop-page
 */
function wc_add_long_description() {
	global $product;

	?>
        <div itemprop="description">
            <?php echo apply_filters( 'the_content', $product->post->post_content ) ?>
        </div>
	<?php
}

Adding the Short Description to the Product Loop on the Shop page

add_action( 'woocommerce_after_shop_loop_item_title', 'wc_add_short_description' );
/**
 * WooCommerce, Add Short Description to Products on Shop Page
 *
 * @link https://wpbeaches.com/woocommerce-add-short-or-long-description-to-products-on-shop-page
 */
function wc_add_short_description() {
	global $product;

	?>
        <div itemprop="description">
            <?php echo apply_filters( 'woocommerce_short_description', $product->post-> post_excerpt ) ?>
        </div>
	<?php
}

You can also limit the content character count by wrapping part of the function in a  substr function, so for example – limiting the full product description to 200 characters

add_action( 'woocommerce_after_shop_loop_item_title', 'wc_add_long_description' );
/**
 * WooCommerce, Add Long Description to Products on Shop Page with Character limit
 *
 * @link https://wpbeaches.com/woocommerce-add-short-or-long-description-to-products-on-shop-page
 */
function wc_add_long_description() {
	global $product;

	?>
        <div itemprop="description">
            <?php echo substr( apply_filters( 'the_content', $product->post->post_content ), 0,200 ); echo '...' ?>
        </div>
	<?php
}

So the above is now limited to 200 characters and also has an ellipse at the end.

ref

11 Comments

  1. LISA RISPAL on November 2, 2020 at 2:52 pm

    Hi! Thanks for sharing all these codes I love your site. I tried that one, only do you know how we can customize the size and color of the text? Thanks again :-)

  2. Laura on February 8, 2020 at 7:02 pm

    Hello,
    Thank you for the guidance.
    Though, the desicription still doesn’t render using the provided code.
    I’ve added it to the functions.php file for my child theme.
    I’m using the Twentyseventeen theme.

  3. WilliamM on January 29, 2020 at 2:25 am

    HI. Thanks a lot for the guide. Do you have any suggestion for adding descriptions to products that are shown via shortcode in blog posts (e.g. shortcode [products limit="-1" columns="3" category="my-category"] inserted on blog posts)?

  4. Alex on December 17, 2019 at 7:09 pm

    Thank you! Do I just add this to my child theme’s function.php?

  5. Jana on December 4, 2019 at 10:35 am

    Hi, thank you for this. What should I do to limit it by words instead of characters, please?

    Thank you

  6. katie on November 15, 2019 at 1:33 pm

    Hi,

    Bullet points don’t appear to show in these listings, anything I need to add to get ‘s working?

    Thanks

  7. PandaPsko on September 27, 2019 at 2:20 pm

    Actually none of those codes work on my site. It just doesn’t show any text. If someone can help, it would help me a lot.

  8. Marcial on June 29, 2019 at 5:27 pm

    Can this be done for all user roles except for just one?

  9. Anthony on June 5, 2019 at 6:43 am

    Hi,

    Thank you for the code! This doesn’t quite put the description directly after the title though, it adds it after the title and price.

    I found I had to change the following:
    add_action( ‘woocommerce_after_shop_loop_item_title’, ‘wc_add_long_description’ );
    to
    add_action( ‘woocommerce_shop_loop_item_title’, ‘wc_add_long_description’ );

  10. Tim on June 4, 2019 at 6:11 pm

    Thank you for this. Solved a big issue for me on an AJAX product filter I was using.

Leave a Comment