diff --git a/snippets/product-grid-item.liquid b/snippets/product-grid-item.liquid index 8e5f9f0f3..f890a8946 100755 --- a/snippets/product-grid-item.liquid +++ b/snippets/product-grid-item.liquid @@ -33,7 +33,7 @@ Check if the product is sold out and set a variable to be used below. {% endcomment %} {% assign sold_out = true %} -{% if product.available %} +{% if product.available %} {% assign sold_out = false %} {% endif %} diff --git a/snippets/product-list-item.liquid b/snippets/product-list-item.liquid index 0b55e355f..0e6492b0c 100755 --- a/snippets/product-list-item.liquid +++ b/snippets/product-list-item.liquid @@ -18,7 +18,7 @@ Check if the product is sold out and set a variable to be used below. {% endcomment %} {% assign sold_out = true %} -{% if product.available %} +{% if product.available %} {% assign sold_out = false %} {% endif %} diff --git a/snippets/search-result-grid.liquid b/snippets/search-result-grid.liquid index ac57537fe..33b210a3c 100755 --- a/snippets/search-result-grid.liquid +++ b/snippets/search-result-grid.liquid @@ -18,6 +18,22 @@ {% assign grid_item_width = 'large--one-third medium--one-half' %} {% endunless %} +{% comment %} + Check if the product is on sale and set a variable to be used below. +{% endcomment %} +{% assign on_sale = false %} +{% if item.compare_at_price > item.price %} + {% assign on_sale = true %} +{% endif %} + +{% comment %} + Check if the product is sold out and set a variable to be used below. +{% endcomment %} +{% assign sold_out = true %} +{% if item.available %} + {% assign sold_out = false %} +{% endif %} +
+ {% comment %}
+ You can show a leading 'from' or 'up to' by checking 'product.price_varies'
+ if your variants have different prices.
+ {% endcomment %}
+ {% if on_sale %}
+ {% if item.price_varies %}
+ {% assign sale_price = item.price | money %}
+ {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+ {% else %}
+ {{ 'products.product.on_sale' | t }}
+ {{ item.price | money }}
+ {% endif %}
+ {% else %}
+ {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
+ {{ item.price | money }}
+ {% endif %}
+ {% if sold_out %}
+
{{ 'products.product.sold_out' | t }}
+ {% endif %}
+ {% if on_sale %}
+ {{ item.compare_at_price | money }}
+ {% endif %}
+
+ {% comment %}
+ You can show a leading 'from' or 'up to' by checking 'product.price_varies'
+ if your variants have different prices.
+ {% endcomment %}
+ {% if on_sale %}
+ {% if item.price_varies %}
+ {% assign sale_price = item.price | money %}
+ {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+ {% else %}
+ {{ 'products.product.on_sale' | t }}
+ {{ item.price | money }}
+ {% endif %}
+ {% else %}
+ {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
+ {{ item.price | money }}
+ {% endif %}
+ {% if sold_out %}
+
{{ 'products.product.sold_out' | t }}
+ {% endif %}
+ {% if on_sale %}
+ {{ item.compare_at_price | money }}
+ {% endif %}
+