Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!-- /snippets/product-grid-item.liquid -->
{% include 'grid-logic' %}
{% assign tag = false %}
{% if product.available %}
{% assign sold_out = false %}
{% else %}
{% assign sold_out = true %}
{% assign tag = true %}
{% endif %}
{% if product.compare_at_price_min > product.price_min %}
{% if sold_out %}
{% assign on_sale = false %}
{% else %}
{% assign on_sale = true %}
{% assign tag = true %}
{% endif %}
{% else %}
{% assign on_sale = false %}
{% endif %}
<div class="grid__item text-center {{ grid_item_width }} {% if tag == true %}has-tag{% endif %} product-item-parent">
<!-- Image -->
{% if settings.enable_quick_buy %}
<div class="grid__image" >
{% else %}
<a href="{{product.url}}" class="grid__image">
{% endif %}
<!-- Tags -->
{% if on_sale %}
<div class="tag"><span>{{ 'products.product.on_sale_html' | t }}</span></div>
{% endif %}
{% if sold_out %}
<div class="tag"><span>{{ 'products.product.sold_out_html' | t }}</span></div>
{% endif %}
<div class = "table">
<div class = "cell">
<div {% if settings.enable_quick_buy %}onclick="window.location = '{{ product.url}}'"{% endif %}>
<img
class="product-image"
src="{{ product.featured_image.src | img_url: '2048x' }}"
alt="{{ product.featured_image.alt | escape }}">
</div>
{% if settings.enable_quick_buy %}
<a href="{{ product.url | within: collection }}" class="btn quick_buy_button">{{ 'products.general.quick_buy' | t }}</a>
{% endif %}
</div>
</div>
{% if settings.enable_quick_buy == false %}
</div>
{% else %}
</a>
{% endif %}
<!-- Title -->
<h3><a href="{{ product.url | within: collection }}">{{ product.title }}</a></h3>
<a href="{{ product.url | within: collection }}">
<!-- Price -->
<p class="price">
{% if on_sale == true %}
{{ product.price | money }}
<span class = "reduced-price"><s>{{ product.compare_at_price | money }}</s></span>
{% elsif product.price_varies %}
{{product.price_min | money }} - {{ product.price_max | money }}
{% else %}
{{ product.price | money }}
{% endif %}
</p>
</a>
{% if settings.show_product_grid_buttons %}
<a class="btn" href="{{ product.url | within: collection }}">{{ 'products.product.view_item' | t }}</a>
{% endif %}
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.