Re: How to display lowest variant price with proper compare to price on Collection Page?

How to display lowest variant price with proper compare to price on Collection Page?

bwfeldman2
Visitor
3 0 0

I am having an issue having my collection pages display the proper "compare to" price for a given variant. Code is below. Using Retina theme. Can someone tell me what to adjust? It is showing the lowest price variant correctly, but I also want it to show the lowest price "compare to" as well. The individual product pages do it correct.

 

https://shop.windchillultimate.com/collections/tickets

 

<div class="clearfix">
{% unless collection_handles contains 'coming-soon' %}
<p class="modal_price left">
<span class="sold_out">{% if variant.available == false %}{{ 'products.product.sold_out' | t }}{% endif %}</span>
<span content="{{ variant.price | money_without_currency | remove: "," }}" class="{% if variant.compare_at_price > variant.price %}sale{% endif %}">
<span class="current_price {% if product.available == false %}hidden{% endif %}">
{% if variant.price > 0 %}
<span class="money">{{ variant.price | money }}</span>
{% else %}
<span class="money">{{ settings.free_price_text }}</span>
{% endif %}
</span>
</span>
<span class="was_price">
{% if variant.price < variant.compare_at_price and variant.available %}
<span class="money">{{ variant.compare_at_price | money }}</span>
{% endif %}
</span>
</p>
{% endunless %}
{% include 'size-chart-popup' %}
</div>

Replies 2 (2)

bwfeldman2
Visitor
3 0 0

This may be relevant code as well. 

 

<div class="clearfix">
{% unless collection_handles contains 'coming-soon' %}
<p class="modal_price left">
<span class="sold_out">{% if variant.available == false %}{{ 'products.product.sold_out' | t }}{% endif %}</span>
<span content="{{ variant.price | money_without_currency | remove: "," }}" class="{% if variant.compare_at_price > variant.price %}sale{% endif %}">
<span class="current_price {% if product.available == false %}hidden{% endif %}">
{% if variant.price > 0 %}
<span class="money">{{ variant.price | money }}</span>
{% else %}
<span class="money">{{ settings.free_price_text }}</span>
{% endif %}
</span>
</span>
<span class="was_price">
{% if variant.price < variant.compare_at_price and variant.available %}
<span class="money">{{ variant.compare_at_price | money }}</span>
{% endif %}
</span>
</p>
{% endunless %}
{% include 'size-chart-popup' %}
</div>

Jahid-KlinKode
Excursionist
145 1 5

Hi @bwfeldman2, check out this brief video tutorial for a quick solution to display variant names and prices on Shopify collection pages.