Skip to content

Instantly share code, notes, and snippets.

@ed-codes
Created September 17, 2018 09:56
Show Gist options
  • Save ed-codes/909cca42aea08c1d335a90f5ee6d5d76 to your computer and use it in GitHub Desktop.
Save ed-codes/909cca42aea08c1d335a90f5ee6d5d76 to your computer and use it in GitHub Desktop.
Show a png image based on product tags with a matching name. e.g. tag a product with 'mens-crew-neck-size-guide' to display a png of the same name.
<section class="item" id="tab-2" data-title="Size Guides">
<div class="item-content">
{% for tag in product.tags %}
{% if tag contains 'size-guide'%}
{% capture tagImage %}{{tag}}.png{% endcapture %}
<img class="size-guide" src="{{ tagImage | asset_img_url: '1200x' }}" width="700" alt="{{ tag }}">
{% endif %}
{% endfor %}
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment