Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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>
Source by magento.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #Limit #Product #Name
ADD COMMENT
Topic
Name
7+4 =