magento2 – Max length as input validation for product name attribute

There are 2 Way to handle this product name

  1. Open Your database , go to catalog_product_entity_varchar ,Change The structure of value column.

(But Their is some little problem -: For Other Attributes, That are store in this table also are affected)


  1. That code you used for showing product name.

    <?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>

you need to change here:-

<?php /* @escapeNotVerified */ $name = $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
<?php echo $name = strlen($name ) > 50 ? substr($name ,0,50)."..." : $name ;?>

This is only for list.phtml .Similarly You Can also do it for other pages.