0

I am trying to display a Product Image but am not able to get the correct data for the Alt Text

$image = $block->getImage($_product, 'category_page_grid');

When I call $image->getLabel() it is returning the name of the Product rather than the Alt Text

2 Answers 2

0

Make You already have filled image alt name in product add/edit page. Actually Magento returns Product name if there is no alt text added for any image. To add alt text on any image just go on product edit page and click on any image and you will see option for alt text. Let me know if anymore help needed.

0

what if we want to show Image label instead of alt tag ? how we can access them?

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.