skip to Main Content

In Shopify, when you assign an Image Alt Text to an image using the online editor, where is that value stored? Apparently, it is not stored in config/settings_data.json of the theme code.

Now I saw that my liquid code has

{{ block.settings.image | img_url: '580x', scale: 2 | img_tag: block.settings.image.alt, 'lazyload transition-in' }}

which means the alt tag value should come from settings, however that’s not the case. It is stored somewhere, but I am not able to find in the theme code.

2

Answers


  1. The alt attribute is stored internally for the object.

    For example when you set a title for the product the title is not stored as a setting, but it’s applied internally to that object.

    In your example you have a block image, you target the image using block.settings.image and from there on you have access to all of the image properties seen in here https://help.shopify.com/themes/liquid/objects/image and ALT is one of them.

    The file settings_data.json stores only information from settings_schema and all of the sections options.

    Login or Signup to reply.
  2. This threads a bit old now, but if anyones looking for a solution – you can grab it by:

    {{ image.alt }}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search