I want to replace the image Alt in category page (list of products) with a variable, I don’t want to keep the product label that Magento use by default, I want to get the value of MetaKeywords of the current Category.
My goal is to apply a single image alt value to all the product of the current category.
We are using a custom template in Magento 2.
I went to this file "image_with_borders.phtml" I tried to replace the value "getLabel" with "getMetaKeywords" but doesn’t work.
Here how the code looks in that file:
alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>"/>
To replace with :
alt="<?= $escaper->escapeHtmlAttr($category->getMetaKeywords()) ?>"/>