Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
In the following code the alt-text of the image does not appear: the meta-object does not have value in the "referenz.image.alt". Is there any way to get the alt-text in a similar way? And YES: the images saved in the meta-object have an alt-text!
{% assign referenzen = shop.metaobjects.referenzen.values %} {% for referenz in referenzen %} <div class="image-item"> {{ referenz.image | image_url: width: 1420 | image_tag: loading: 'lazy', class: 'masonry-card__image' }} </div> <div class="image-caption">{{ referenz.image.alt | escape }}</div> {% endfor %}
In your code, if `referenz.image.alt` is not returning the alt text, it might be due to how the image object is structured within the `metaobjects`. To access the alt text, ensure that the `image` object in `referenzen` actually contains the `alt` attribute. Alternatively, consider using a different method to fetch the alt text, possibly by accessing the image details through Shopify's API or checking if there's a different attribute in the `metaobjects` structure that holds the alt text.
Yes, at this point I'm sure the `image` object in `referenzen` does not contain the `alt` attribute. Also, I could not find any information on the structure of metaobjects suggesting that the alt-text of images can be accessed via a specific attribute... 'referenz.image.alt' was my best guess. Is there any other way to get the alt-text via the image URL from 'referenz.image'?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025