Skip to content

How to limit the product excerpt in Hestia Pro ​

This guide will help you to limit the product short description to a certain number of words. This can be achieved by adding the following code at the end of the functions.php file of the child theme.

For creating/downloading a child theme for Hestia Pro please check this documentation.

function custom_woocommerce_short_description($post_excerpt) { 
    if (!is_product()) { 
        $post_excerpt = wp_trim_words($post_excerpt, 15); 
    } 
    return $post_excerpt; 
}
add_filter('woocommerce_short_description', 'custom_woocommerce_short_description', 10, 1);

The number of words can be changed to the desired value, in the above code is 15.

In this article

This how the shop page looks by default ​

This is how the shop page looks with a maximum of 15 words in the product description ​

Was this helpful?