Can't believe there is no standard workaround to limit product title for the related product section. So far, I managed to limit product title for all other pages by using Woo Title Limit plugin.

By using this plugin, I can make the related product to limit its title by inserting limit to single product page, but then it will affect the single product title also. So, I think the best way is to add it manually for the related product.

I think this is the standardize code to limit product title character.

    if ( strlen( $title ) > 60) { // Kicks in if the product title is longer than 60 characters 
  return substr( $title, 0, 60 ) . '...'; // Shortens it to 60 characters and adds ellipsis at the end
} else {
  return $title; // If the title isn't longer than 60 characters, it will be returned in its full length without the ellipsis

Now, the problem is where can I apply this code? I can't just simply paste this code inside the related.php page right? Mine guiding me on what things I need to sort out first?

1 Answer 1


Problem solve based on this article https://designsmaz.com/how-to-short-woocommerce-products-title/#comment-76957

Basically I just replace the <?php the_title(); ?> to

$shorttitle = mb_substr(the_title('','',FALSE),0,45); 

echo $shorttitle; 
if (strlen($shorttitle) >44){ 
echo '&hellip;'; 


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.