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 = substr($post_excerpt, 0, 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.

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

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us