Skip to content

Instantly share code, notes, and snippets.

@aatronco
Last active January 24, 2019 19:31
Show Gist options
  • Select an option

  • Save aatronco/47205e4f1f2057013d7d9b17b9425292 to your computer and use it in GitHub Desktop.

Select an option

Save aatronco/47205e4f1f2057013d7d9b17b9425292 to your computer and use it in GitHub Desktop.
{%assign min_price = product.price %}
{%assign max_price = product.price %}
{% for variant in product.variants %}
{% if max_price < variant.price %}
{%assign max_price = variant.price %}
{% endif %}
{% if min_price > variant.price %}
{%assign min_price = variant.price %}
{% endif %}
{%endfor%}
{%if min_price != max_price %}
{{ min_price| price }} - {{ max_price| price }}
{%else%}
{{ product.price | price }}
{%endif%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment