Replace Excerpt with Content in WooCommerce
WooCommerce gives you the option to provide a shorter product description (like an excerpt) as well as a longer description. In most themes, the short description appears in the product summary area along with the product title, price and add to cart form, next to the images. The long description appears in the tabs underneath.
This is fine a lot of the time but often, especially if your product descriptions are quite brief, you don’t need two separate fields. And if you’re used to working with WordPress it’s quite unintuitive to ignore the main content area and add your product description to the short description field, positioned towards the bottom of the edit page.
It’s simple enough to remedy this by unhooking the short description from the product summary area and replacing it with the main content. Add this to your functions.php
file to avoid any messing around with WooCommerce template files.
/* * Remove excerpt from single product */ remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); add_action( 'woocommerce_single_product_summary', 'the_content', 20 );
Hi Gareth,
I’m looking for a function to show the same excerpt on all products automatically and found your website. The above function comes close but when I change the ‘the_content’ to ‘mytext’ it doesn’t work. Would it be possible to do this and how could I do this?
Kind regards
I guess if you want to display exactly the same text on each product you could just add a filter to
the_content
– https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content – or even onwoocommerce_single_product_summary
.Gareth,
My descriptions are not terribly long so I’m thinking of swapping the excerpt with the product description. Assuming I do, what’s the least taxing way to do that? And is there any real SEO value to the excerpt? Yoast does not appear to take excerpt into account at all when scoring a page. If that’s the case, I may want to suppress the new ‘tab’ that (now) contains the excerpt. How do I do that?
Thank you so much for this! With your help and this short code, I have managed to replace the short product description with something else altogether. Life saver.