How to generate product image alt text from attributes in Magento 2
What would a shopper miss if the photograph disappeared?
The first photograph shows a burgundy hiking boot. The second is a close-up of the silver ankle buckle. A shopper looking at the gallery learns how the fastening works. Someone listening to the gallery only gets that detail if the text conveys it. Hearing the product name twice tells them nothing about the buckle.
For a large catalogue, start with main images shot from a consistent angle. Model name and colour can often identify what is shown. Put close-ups, dimension drawings and photographs demonstrating use into a separate editorial review.
Build a rule using real catalogue values
Kowal Image Alt From Attributes assembles alt text when the page is displayed. Open Stores → Configuration → Customers → Image Alt From Attributes, select the intended store view and try {product_name} {product_color}. With “Runa hiking boot” in the name field and “burgundy” in the colour field, the result reads “Runa hiking boot burgundy”.
Try a second product whose name already includes “burgundy”. Adding the colour again makes the text repetitive. Now try a product with a blank colour field. Is the remaining name specific enough? These examples tell you whether to simplify the pattern or fix the underlying data. A SKU can be useful when a visible part number helps identify a spare part.
Three images that call for different treatment
- Full product. “Burgundy Runa hiking boot” identifies the model and colour.
- Detail shot. “Metal buckle at the ankle of the Runa boot” conveys what the close-up adds. A rule built from attributes shared by every photo cannot identify the camera angle. Test how your theme handles a per-image description alongside the extension.
- CMS decoration. A visual divider may have deliberately empty alt text. The module has a separate CMS pattern for images with an existing empty alt attribute. Include a decorative divider in your trial before enabling a general rule for content pages.
Check what reaches each storefront
Choose one fully populated product, one with no colour and one with several detail shots. Open each in both languages. Inspect the rendered img element and read its alt value. Then listen to the gallery with a screen reader. Check the language, listen for repetition and ask what each photograph contributes. An Admin label alone cannot verify the output of a render-time rule.
Save one good example and one failure with their product URLs. They make useful test cases after a theme update or a catalogue import. Google provides further guidance on descriptive alt text in its image search documentation.