Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Display product description on WooCommerce shop/category pages
* Add the product's short description (excerpt) to the WooCommerce shop/category pages. The description displays after the product's name, but before the product's price.
* Ref:
* Put this snippet into a child theme's functions.php file
function woocommerce_after_shop_loop_item_title_short_description() {
global $product;
if ( ! $product->post->post_excerpt ) return;
<div itemprop="description">
<?php echo substr(apply_filters( 'woocommerce_short_description', $product->post->post_excerpt ),0,230);
echo '...'
add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_title_short_description', 5);

This comment has been minimized.

Copy link
Owner Author

twont commented Nov 12, 2018

Changed to limit description to 230 characters, and will add '...' to the end of the the snippit.

Credits also to: @amanhstu


This comment has been minimized.

Copy link

klynn33 commented Dec 7, 2018

This works great but the whole description displays as a clickable link (I verified it wasn't the theme).
Also it's displaying the description before the title, instead of below in shop page.

Any ideas for fix?


This comment has been minimized.

Copy link

LinnightL commented Apr 22, 2019

Replace all

The following will offer understanding
WooCommerce Archive Page [Visual Hook Guide]


This comment has been minimized.

Copy link

KrisKomjati commented May 23, 2019


I don't know why but if the text does not reach the character limit we set, the ellipsis will be there at a fixed point. I assume we should make an if statement that makes the ellispsis only if the text exceeds the character limit. Can you help me with that?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.