WooCommerce has a filter that can limit the words in a product short description field  called ‘woocommerce_short_description‘ – coupled with an existing WordPress function ‘wp_trim_words‘ we can make the description any length to suit teasers, sliders etc and leave other areas where we want the full short description.

View the code on Gist.

In the code snippet above we are using a conditional to apply this to any usage of the short description outside of a single product post, the filter uses the 1 parameter $post_post_excerpt which is assigned to $text, the $word count is set to 10 with a […] used as the $more valuethese three parameters belong to wp_trim_words which is executed and returned back to $post_post_excerpt – which is now a 10 word product short description.



Leave a Reply