boldsupport
1/6/2016 - 4:49 PM

Display the sales icon on a collection preview if any product inside the collection is on sale.

Display the sales icon on a collection preview if any product inside the collection is on sale.

{% comment %} The collection needs to be in a variable named 'collection' {% endcomment %}

{% assign has_sale_products=false %}

{% for product in collection.products %}
  {% if product.metafields.inventory.ShappifySale == "true" %}
    {% assign has_sale_products=true %}
  {% endif %}
{% endfor %}

{% if has_sale_products %}
  <img class='shappify-sales-icon-collection' src='//secure.apps.shappify.com/apps/discount/icons/default/sale13.png' />
  <style>
    .shappify-sales-icon-collection{
      position: absolute;top: 5px;right: 0;;z-index:999;
    }
  </style>
{% endif %}