WooCommerce: Show Product Description @ Shop Page

If you want to show the “short description” field on the products that are on your homepage or in the loop, here’s the PHP code to add to your functions.php.

Here’s my brand new Shop page, where each product displays its short description

PHP Snippet: Show Product Description @ Shop / Category / Loop Pages

/**
 * @snippet       Show product short description @ WooCommerce Loop
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_action( 'woocommerce_after_shop_loop_item_title', 'bbloomer_shop_product_short_description', 35, 2 );

function bbloomer_shop_product_short_description() {
     the_excerpt();
}

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

37 thoughts on “WooCommerce: Show Product Description @ Shop Page

  1. Worked great…how do we remove the link to the product from the text? is there a way to strip it of the href?

    1. Hi Andy, you can change hook or hook priority (based on your theme) and put it after the closing link tag

  2. Hi Rodolfo! How can i make this work for a certain category?

    1. Sure! I suggest you take a look at “conditional logic”: https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Enjoy πŸ™‚

  3. Hi, i tried this code and many other codes but i m getting the same error. The product description is always coming above the product image in the shop page. Any solution?

    1. It really depends on your theme and custom CSS. Try changing “35” with a higher number, or check your custom CSS for “absolute” positioning or similar

  4. What about adding short description for woocommerce product blocks?

    Do they have some kind of hook like ‘woocommerce_after_shop_loop_item_title’ ?

    1. No, it’s a little more complex in that case

  5. Hi there,
    I am new to wordpress so excuse me it I am asking stupid questions:
    I inserted your code to my functions.php, but for some reason the description still doesn’t show up.

    What I am aiming to do is to add the description to the products displayed on the startpage, for example using the block “product by category”.

    Any clue what might be going wrong for me?
    Thanks in Advance!

    1. Not sure if this is block-friendly. Also, there might be a million reasons unfortunately. Keep trying, maybe with a different theme and no plugins but Woo, and let me know

  6. Hi. Great work.

    Is it possible to display the short description for all user roles except for just one specific? Thanks in advance.

    1. Hi Marcial, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  7. Is there a way to display the short description on mouse over shop image? Thank you.

    1. Hello Tania, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

    2. Thank you! I kind of thought that as I haven’t been able to find how to do it anywhere. Thank you for contributing so much to helping understanding woocommerce, very much appreciated.

  8. How can I show only the short description? This is showing long description if no short description is given for the product, when instead I want nothing to be shown if there is no short description.

    Thanks!

    1. Hey Joe, thanks for your comment! “the_excerpt” should only echo the short description – is that the one you’re using?

  9. Hello Rodolfo,

    I tried adding exact the same code snippet from above but my problem is, that the function is there but it’s not being displayed properly. So there is the text but it’s not visible. First I have to change the style (e.g. the font-size to 13px) in style.css to make it visible. Why is that? Is it normal that I have to edit also the style.css to make a custom action added to a hook visible?

    Thanks in advance!

    1. Hey Martina, thanks for your comment! Yes, this probably depends on your custom theme – that’s why I added a class inside the HTML so that you can customize it as you wish πŸ™‚

      1. Try to replace the body of the function with:

            echo '<div class="product_excerpt">';
        	the_excerpt() ;
        	echo '</div>';

        and declare the class style as you wish.

  10. Hi Rodolfo,
    I was trying to do something similar as your article.
    What I would need to do is to add a short description for each product in the checkout page. I have done tons of research and this is the best I have come up with:

    $post_data->post_excerpt );
    return $other_data;
    }
    ?>

    The issue is that with this code I can only display the number 1, but I can’t see my product decription or attributes…
    Can you help me with that? I have tried everything I can…
    Thank you

    1. Paloma, thanks so much for your feedback! Yes, this is possible – but unfortunately this is custom work and I cannot provide this solution on the blog right now. If you would like to get a quote, feel free to go here. Thank you! R

  11. Thank you for the article. Can you please help me with a problem. How I can remove short description from the Archive page for the variable product only?

    1. Hi Sourav, you can simply wrap the function contents within this conditional check:

      function …. {
      if( $product->is_type( ‘simple’ ) ){
      // function content
      }
      }

  12. Thank you….

  13. Hi Redolfo,
    Thanks so much for this! I’ve been searching for this solution and yours is the only one that is understandable to someone NOT too confident with coding! I’ve added the code and can now see the short description here: https://journey2health.co.za/index.php/shop/
    I would like to make the description even shorter – perhaps only about 20 words. Any advice on how to do that would be GREATLY appreciated!

    1. Thank you Charine, much appreciated πŸ™‚ I see your website is broken so I can’t really help with the second question. However take a look at this article I wrote: Woocommerce: How to shorten product titles because that’s very similar to what you’re looking for! Hope this helps. R

  14. hello I’m Not able to get the content of the product .
    I am using “storefront ” Theme i.e woocomerce free theme.

    On home page I want to show Read more button with description.
    Thanks

  15. here is the question

    1. Hi Eliza, what do you exactly mean with “excerpt from the second description”? Is that the long description?

  16. hey ! may you help me please to display the excerpt from the second description of the woocommerce. here is the website . The excerpt should be about the 100.

    Code from content-product.php

    <a href="”>

    $tab ) : $i++; ?>

    <div id="content_tab_” >

    the function that return me the product description is
    . I can’t figure out how to substr it

  17. Hi Rodolfo,

    Thank you again for the tip.
    $post->post_content didn’t work for me but $post_data->post_content did.

    I really appreciate your expertise and time. It helped me to get it working and understand a bit more. How exciting!

    Regards

  18. Hi Rodolfo,

    Thanks for getting back to me. I appreciate your time and expertise.
    I’m very new to web design as a hobby and fumbling through it.
    The code below gives me the product short description in the cart.
    What changes to this code will give me the long description in the cart?
    (the_content)

    add_filter( ‘woocommerce_get_item_data’, ‘wc_checkout_description_so_27900033’, 10, 2 );

    function wc_checkout_description_so_27900033( $other_data, $cart_item )
    {
    $post_data = get_post( $cart_item[‘product_id’] );
    $other_data[] = array( ‘name’ => ‘description’, ‘value’ => $post_data->post_excerpt );
    return $other_data;
    }

    thanks

    1. Try use $post->post_content instead of $post_data->post_excerpt πŸ™‚

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published. Required fields are marked *