How to Limit the WooCommerce Product Short Description in Related Products?
-
Hi everyone,
Really hope to get some help here.
So the short description for my website is too long to be fully displayed in the product catalogue thumbnails. I managed to shorten that with the following code.// Truncate short description add_filter( 'woocommerce_short_description', 'prefix_filter_woocommerce_short_description' ); /** * Limit WooCommerce Short Description Field */ function prefix_filter_woocommerce_short_description( $post_post_excerpt ) { if(! is_product() ) { // add in conditionals $text = $post_post_excerpt; $words = 8; // change word length $more = ' [...]'; // add a more cta $post_post_excerpt = wp_trim_words( $text, $words, $more ); } return $post_post_excerpt; };
Unfortunately, this doesn’t solve the problem for the short description displayed for Related Products (See the link attached). Please help to shorten that as well.
I am looking to keep the full description on the single product pages, but to have them short in the product catalogue and related products.
Thanks in advance, and please be kind as I am by no means a developer ??The page I need help with: [log in to see the link]
- The topic ‘How to Limit the WooCommerce Product Short Description in Related Products?’ is closed to new replies.