Skip to content

Instantly share code, notes, and snippets.

@richietyler
Last active November 1, 2020 19:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richietyler/94aacb9ac9d093848ffdfc2bee5d25e8 to your computer and use it in GitHub Desktop.
Save richietyler/94aacb9ac9d093848ffdfc2bee5d25e8 to your computer and use it in GitHub Desktop.
{% for opt in product.options_with_values %}
{% if opt.name == 'Size' %}
{% for var in product.variants %}
{% if var.available %}
{% assign spanclass='size-label'%}
{% else %}
{% assign spanclass='size-label size-sold'%}
{% endif %}
{% if opt.values contains var.option1 %}
{{var.option1}}
{% elsif opt.values contains var.option2 %}
{{var.option2}}
{% elsif opt.values contains var.option3 %}
{{var.option3}}
{% endif %}
{% endfor %}
{% break %}
{% endif %}
{% endfor %}
<style>
.size-label {
padding: 3px;
margin: 2px;
border-radius: 3px;
white-space: nowrap;
}
.size-sold {
color:gray;
text-decoration:line-through;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment