kowal.info

Image Alt From Attributes

Composer kowal/module-imagealtfromattributes · Version 1.0.1

Product page

Image Alt From Attributes — kowal.co

Description

Builds alternative text for product images from selected catalog values.

For whom

For catalog editors maintaining descriptive image text across products with different names, colours and sizes.

Features

  • Compose product image alt text from an ordered set of attribute tokens.
  • Include product identifiers or descriptive values such as colour and size.
  • Configure CMS image alt text separately.

Installation

From the Magento root, with Composer access to the Kowal package, run

composer require kowal/module-imagealtfromattributes
bin/magento module:enable Kowal_ImageAltFromAttributes
bin/magento setup:upgrade
bin/magento cache:clean

Configuration

Open Image Alt From Attributes → General Setting in store configuration and turn on Enable Module. In Alt Tag Structure, enter a pattern such as {product_name} {product_color}. The extension reads the tokens in braces and joins the values with spaces. For a product named “T-shirt” with the colour “Navy”, the expected text is “T-shirt Navy”.

Other supported tokens include {product_sku} and {product_size}. The CMS Images Alt Tag section has separate settings for CMS images.

Requirements / notes

Choose attributes that identify what is visible in the image. Check an item with incomplete data as well as one with every selected attribute.

FAQ

Why does the alt text contain the product name but no colour?

Check that the pattern contains {product_color} and the product has a colour value. An empty value contributes no text.

Verify the installation

Save the configuration and open a product that has a colour value. Inspect the image’s alt attribute in browser developer tools. Repeat with a product that has no colour assigned. The empty colour value should be omitted.