Shopify themes, liquid, logos, and UX
https://i1hxd88d7pu01fud-61323608109.shopifypreview.com
im trying to make a text update based on the alt text.
the alt are
red color "image_1"
black color is "image_2"
white color is "image_3"
the code writes the first image's alt but not the other. why? what should i adjust for it to be updated?
{% assign main_image_alt = product.featured_image.alt | downcase %}
{% if main_image_alt == 'image_1' %}
{{" image number 1 "}}
{% elsif main_image_alt == 'image_2' %}
{{" image number 2 "}}
{% elsif main_image_alt == 'image_3' %}
{{" image number 3 "}}
{% endif %}
Hi @orhl1234 , it seems like you want to change the label "Image number 1" when you want to change the variant, right? When you render the liquid code, it executes on the server-side, and when you change the variant, the code will be re-rendered on the client-side (depending on the theme you're using), so the text not being correspondingly re-rendered. Additionally, the code snippet: {% assign main_image_alt = product.featured_image.alt | downcase %} will take the first image of the product, resulting in the text always displaying according to the first image. If you want to fix this, you can use JavaScript code.
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
Hi @orhl1234 , it seems like you want to change the label "Image number 1" when you want to change the variant, right? When you render the liquid code, it executes on the server-side, and when you change the variant, the code will be re-rendered on the client-side (depending on the theme you're using), so the text not being correspondingly re-rendered. Additionally, the code snippet: {% assign main_image_alt = product.featured_image.alt | downcase %} will take the first image of the product, resulting in the text always displaying according to the first image. If you want to fix this, you can use JavaScript code.
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
hi!
could you maybe help me with that?
Hi!
Can you kindly share your store link (with the password, if any), name theme with us? We will check it and suggest you a solution if possible.
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
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