Shopify themes, liquid, logos, and UX
I was wondering how I could get the variation image while inside the options.values loop? My current code looks like this:
{% for value in option.values %}
{% for variant in product.variants %}
{% if value == variant.title %}
{{ variant.image.src | product_img_url: medium }}
{% endif %}
{% endfor %}
{% endfor %}
This works perfectly when there is only 1 option like "Color", the issue I run into is where there are multiple options like "Color" and "Lenth". Then the values do not match the variation.titles.
Example: Our example product has "Color" and "Length" options instead of just "Length". The following is the output.
{{value}} = RED
{{variation.title}} = RED / 16"
Is there an easier way to pull the variation images this was on Dawn 7.0.1
I was looking to keep this starting with
{% for value in option.values %}
{% for variant in product.variants %}
Also, I did ask Chatgtp and it replied with something VERY similar which just didn't work.
User | RANK |
---|---|
182 | |
150 | |
80 | |
72 | |
61 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023