Show Products Short Description on Shop Page

Not much time ago I was searching on Google some stuff for WooCommerce, and I found a request from a user asking how to show the product short description on the shop page.

I don’t think it could be useful for all shops, but it could for some.

Here’s how you can do it.

Add this code at the end of the file functions.php in wp-content/themes/your-child-theme-name/:

add_action( 'woocommerce_after_shop_loop_item', 'woo_show_excerpt_shop_page', 5 );
function woo_show_excerpt_shop_page() {
global $product;
echo $product->post->post_excerpt;
}
view raw functions.php hosted with ❤ by GitHub

The snippet above will print the product short description between the product price and the Add to Cart button.

I’d suggest to use it only if you don’t have too many products in your store and if the short description is not long. Otherwise, your store page could became very long and also it won’t be easy to read the description.

Contribute to Improving This Blog

Did you enjoy this article? Was it helpful? Contribute to help me writing more articles! The funds collected from this blog are reinvested directly into improving my skills or the blog so that I can provide more and better content!

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

$5.00
$15.00
$100.00
$5.00
$15.00
$100.00
$5.00
$15.00
$100.00

Or enter a custom amount

$

Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

Do you prefer using cryptocurrency? I’ve got you covered! You can donate at the following wallets:

  • BTC: bc1q87nxpdpqw323ccmerrzyeffs72wnxpw93x7pzk / 17Gtc5e8yoh2LZzokoyK8P5DWbToBwztok
  • ETH: 0xA5C89Be1df2896C3942DBEf751cCeacC7929388b


More Posts That You Might Like…


43 responses to “Show Products Short Description on Shop Page”

  1. Hi there. Thanks very much. This is almost exactly what I’m looking for. However, it is possible to include rendered audio shortcode. I want to have a play button under each product on the shop page.
    This piece of code just prints the actual shortcode , like ‘[audio mp3="https://www.mysite/wp-content/uploads/2017/01/xxx.mp3"][/audio]

    Thanks very much in advance. Also, I realise this was posted a while ago. It’s funny what you stumble across in searches : )

    1. Hi Gary,
      Replace echo $product->post->post_excerpt; with do_shortcode( echo $product->post->post_excerpt );.

      That will do the trick.

  2. Just a quick update. I found another piece of code which does what i needed. However, the play button is also a link to the single product page, so clicking play also loads the single page.
    I just need to fix that.
    This was the line of code:
    add_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_single_excerpt’, 5);

    Thanks

  3. Hi Nicola. Thanks so much for the swift response : )
    Our replies must have crossed in the aether.

    I’ve tried your edited code but it throws up an error.
    add_action( ‘woocommerce_after_shop_loop_item’, ‘woo_show_excerpt_shop_page’, 5 );
    function woo_show_excerpt_shop_page() {
    global $product;

    error here>> do_shortcode( echo $product->post->post_excerpt );
    }

    Thanks again

    1. Oh yeah, sorry!

      It’s echo do_shortcode( $product->post->post_excerpt );.

  4. Genius : ) Thanks so much. Have a great day.

  5. hello again. I’m sorry if this is slightly straying from this topic but it relates to the short description.
    On the single product page, under the short description, is a list of categories the product is associated with. Like this:

    Categories: female,10-12,t-shirt,jeans,shoes, green, red

    What I’m trying to do is limit the categories shown to a few specific ones (some of my products list maybe 10+ categories. I only really want two or three) and also add a title before the ones i pick.
    Something like:
    Gender: female
    Size: 10-12
    Color: green, red.

    I was seeing if the title idea was possible by displaying the category description before each category (like category desc ‘Gender: ‘ for category ‘Gender’ with sub categories ‘male’ and ‘female’ but I’m no programmer so have to search for code snippets via many a google search. However, the ones I’ve found, I can’t get to work. It’s very frustrating.

    I appreciate this is basically two thing; limit the categories displayed and add a title (maybe another way?) … and get them each on a new line : )

    Apologies for reaching out to you again and i’ll understand if you tell me to ‘get lost’ : )
    Any guidance very gratefully received.

    Kind regards

    Gary

  6. Thanks for the code, it works for me as I wanted to have short description in my product listing at homepage.

    But my short description is long to display at homepage. Its better if I only display not more than 1 sentence, about 100 characters. How can I limit this?

    1. Hi,
      you can use echo substr( $product->post->post_excerpt, 0, 100 );.

      You can find more documentation about substr here.

  7. Hi Nicola!

    I was wondering if it would be possible to have the description directly under the title of the product (followed by the price)

    Reason for asking is for the many variable products I have — it isn’t necessary to have an “Add to Cart” button as you will have to choose your option before you do so anyway.

    It would preferably need to be in this order!

    Product Image
    Product Title
    Product Description
    Product Prices

    Here is an example I’ve thrown together!

    Mobile: https://i.imgur.com/wxOuxLQ.png
    Laptop/Desktop: https://i.imgur.com/165hUlw.png

    Thanks in advance!
    Adam

    1. Hi Adam,

      I was struggling with exactly the same thing. change ‘woocommerce_after_shop_loop_item’ to ‘woocommerce_after_shop_loop_item_title’. Worked for me!

      1. This worked perfectly for me! Thanks!

  8. H Nicola,

    Excellent article, thanks. Is there a way to limit this to only 1 category rather than display for all categories?

    Apart from that it works just as I need it to.

  9. Hi!, is there a way to limit the amount of characters displayed after the product, to lets say 80 words? Let me know, thank you!!

  10. How only display two line description under the product but the product full detail Display to a particular product page? Please help me?

  11. How only display two line description under the product but the product full detail Display to a particular product page? Please help me?

  12. Hi. Thanks for your will to help others. Can i know a way to make the snippet work to show the short description to sol user roles except for just one? Thanks in advance.

  13. Just want to say Thank you! Excellent solution

  14. I added the short description to the category page using your code (thanks!).. any idea how to put this info inside of a coloured box?

  15. Hey, is there a way to edit the exceprt length?

  16. Hi Nicola. Thanks for the code. Is there any way I can change the color of the text? Would that code need to follow the previous code? Please advise.

  17. Hi is it possible to have the label or the short description in an hover of the image ?
    Regards

    1. Yes, that would be possible. It will require more than just this PHP. You should add CSS to hide the label. I recommend writing on the WordPress.org forum (https://wordpress.org/support/plugin/woocommerce/) about this if you need help with the coding!

  18. HI! i should paste this given code but short description is show on upper area of product not in bottom please advise what will i do
    thankyou

    1. Hello, that might be because of your theme. I cannot on this via comments because of the nature of the issue. I’d recommend contacting the theme author and checking with them.

  19. Hello and thanks for all your advice. I need to see the long description below the products. How can I do? Thanks again

    1. Hello Giulia,
      On line 5, instead of echo $product->post->post_excerpt; use echo $product->get_description();.

  20. I like to specify how much to show, i like to show just a part of description not all of it, can you help me pls. ?

  21. Guys do not forget to close the php instructions at the end ?>. Keep trowing me an error without it. 😉 Now it work! Great thanks!

    1. You should not need the closing tag, I would actually recommend against it.

      But it really depends on your file. In general, you do not need to close the tag.

      1. I know, but it was not working without it 😉 Maybe because i am working with oxygen. Go figure.

  22. I’d be willing to pay someone to implement this. I can’t get it to work, despite reading every comment from first to last.

    with that said, this is what the information looks like that was provided from the wholesaler’s CSV and is subsequently what is uploaded into my woocommerce.

    voodooBilletBrand: VooDooColor: BlackMaterial: Billet RubberFittment infoUniversal: Universal | Universal

    Maybe the HTML is screwing it up?

    Thanks in advance

    1. ah. this site ate the html. https://prnt.sc/10gm7m4 THAT. is in the “short description” area, due to the CSV. i guess i could eliminate the HTML in the csv and re-upload, but im not sure it would cause failure of this code.

      thanks

      1. Hello there,
        I do not think that the HTML is a problem. Maybe it’s just that the description is not uploaded properly or that there’s no excerpt in the product details.

        If you need someone to help you with adding this, you can hire an expert here: https://woocommerce.com/customizations/

        1. I can check the database to see if there is anything in it, but, short descriptions show up in the actual product page. https://tpcparts.com/product/1packing/

          do you know off hand what field in the database would need to be propagated?

          Thanks !!

  23. ibrahimrumaniIbrahim Avatar
    ibrahimrumaniIbrahim

    Can you help add the wp_trim_words() to this

  24. Is there any plugin for this and other controls like this for other filters, whenever the theme updates I have to pay attention to all filters or I’m starting over again, which just happened by mistake. My fault, thanks so much for your help and the great contribution provided here.

    1. Hello,
      I am not aware of a plugin for this, but I wrapped up the script from the article in a file that you can download and use as a plugin: https://gist.github.com/SiR-DanieL/fab0d06aa58c9244aa6d0df4d34cf685

      To install it, you can either upload the file via FTP in the wp-content/plugins/ folder, or zip it and then upload it from the Dashboard.

      I did not test it but it should work just fine.

  25. Hi! I am using the WooLentor plugin’s widget called WL: Universal Product Layout. Wondering if you can help me add the short description to this widget – will donate after if you can save me the efforts! Thank you!!

    1. I am sorry but I am not familiar with WooLentor! I’d recommend asking on the WP.org forums directly to the developers of the plugin!

  26. karlboxwoodorg Avatar
    karlboxwoodorg

    Great article! That and comments here have me almost where I want to be. Is there a way to keep the SHort Descriptons formatting (line breaks, bold, etc) when I display the short description in the shop page? I have items with brief information list and want to keep that formatting, such as:

    Date
    Time (with time zone)
    Type

Leave a Reply

Categories

Newsletter

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Blog at WordPress.com.

%d bloggers like this: