Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I have been working my head around this;
It should be possible to access images via {{ images['somefilename'] | asset_image_url }} yet no matter what I attempt, it always returns a bad url. Even though the image files are clearly there.
I'm trying so that it'll decide which picture to use as the size chart depending on brand, gender etc.
It can determine properly which brand it is, it just does not find the correct foto file. (Which exists, case matching etc).
Hope anyone has a fix for this particular issue.
<h2 class="size-chart-title">{{section.settings.header}}</h2> {% if product.metafields.custom.brands == 'Adidas' %} {% assign chart = 'Adidas.png' %} {% elsif product.metafields.custom.brands == 'Gucci' %} {% assign chart = 'Gucci.png' %} {% endif %} <img src='{{ images[chart] | asset_img_url }}' alt="" style="width:20vw; height: 50vh"> <script type='text/javascript'> console.log('{{ chart }}') console.log('{{ images[chart] | asset_img_url }}') </script>
Solved! Go to the solution
This is an accepted solution.
Hi @ialusion,
It is not static, it is changed according to the original condition you added. Refer:
Hope it helps!
Hello @Ialusion
<img src='{{ chart | asset_img_url }}' alt="" style="width:20vw; height: 50vh">
Regards,
Store Watchers Support Team
Hi there,
This is not what I mean. You're presetting a single image file. While I try to have one dynamic chart which changes on the same prop on various brands, etc.
This is why I need to do something like images[].
Hi @ialusion,
You can follow the instructions below:
- Step 1: Upload 2 images at Assets( Adidas.png and Gucci.png ).
- Step 2: Please change code:
<img src='{{ chart | asset_url }}' alt="" style="width:20vw; height: 50vh">
Hope it helps!
Same answer, just different way of telling it. Still what you are doing is one static image source. I need it to adapt based on conditions.
This is an accepted solution.
Hi @ialusion,
It is not static, it is changed according to the original condition you added. Refer:
Hope it helps!
Thank you, it did work. It was my fault for not trying it properly.
In Canada, payment processors, like those that provide payment processing services t...
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