Sunday, 7 July 2019

Display product image in custom phtml file Magento2.

Use below code for display product image in custom template file.

$_imagehelper = $this->helper('\Magento\Catalog\Helper\Image');

 <img src=" <?= $_imagehelper->init($_product, 'product_page_image_small')->getUrl(); ?>" width="100" height="100" alt="product-image"/>

No comments:

Post a Comment