Answers for "Limit Product Name in Magento2"

PHP
2

Limit Product Name in Magento2

<?php
$productName = $_helper->productAttribute($_product, $_product->getName(), 'name');
$len = strlen($productName);
?>
<a class="product-item-link" href="<?php echo /* @escapeNotVerified */ $_product->getProductUrl() ?>">
    <?php echo substr($productName,0,50); ?>
    <?php if($len > 50) echo '...'; ?>
</a>
Posted by: Guest on August-24-2021

Code answers related to "Limit Product Name in Magento2"

Browse Popular Code Answers by Language