How do I insert multiple files into my code?

Highlighted
Tourist
5 0 1

Hi, I was looking for implementing color swatches to my shop. I found this code but I have a question.

Where it says "link to your files" how do I add more than one image? (I've tried with commas, hosting files..) It partially works but it only appears the first link image, the following ones don't.

 

Thanks.

 

{% for option in product.options %}
        {% if option == 'Color' %}
            {% assign index = forloop.index0 %}
            {% assign colorlist = '' %}
            {% assign color = '' %}
            {% assign colorweb = '         link to your files         ' %}
            {% for variant in product.variants %}
                {% capture color %}
                    {{ variant.options[index] }}
                {% endcapture %}
                {% unless colorlist contains color %}
                    <img src="link-to-your-files{{ color | downcase | strip_newlines | strip_html | replace_first: ' ', '_' | remove: ' ' | append: '.gif' }}" width="16" height="16" border="0" alt="{{color}}" style="border: 1px solid black;" />
                    {% capture tempList %}
                        {{colorlist | append: color | append: ' '}}
                    {% endcapture %}
                    {% assign colorlist = tempList %}
                {% endunless %}
            {% endfor %}
        {% endif %}
    {% endfor %}

This is how it looks like:

0 Likes
Highlighted
Shopify Partner
2294 117 356

the variable colorweb is only assigned then never used in that code

it seems to want the first part of a CDN url then later use variables to finish the url 

//cdn.shopify.com/s/files/1/2345/6789/files/{{ color | downcase | strip_newlines | strip_html | replace_first: ' ', '_' | remove: ' ' | append: '.gif' }}

 

Linking to your files is often in reference to admin file uploads

https://help.shopify.com/en/manual/online-store/legacy/file-uploads

then using the liquid filter file_img_url

 

It may also be referencing adding those to your themes assets folder

https://shopify.dev/tutorials/develop-theme-templates#assets

 

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes