Display Price ranges - sale, regular price

torasaki
Excursionist
13 1 0

I'm looking to display a few different price types on the product list page:

  1. Regular price
  2. Regular price range (showing prices of variants)
  3. Sale price w/ regular price crossed out
  4. Sale price range w/ regular price range crossed out

I've been fiddling with elsif statements in the product-block.liquid file. I was able to get the all the options to work, except when it's only regular price (no variants). It will show a price like $24.95 - $24.95 even though the product doesn't have variants.

I've attached a screenshot below for what I'd like to have. Any help is much and greatly appreciated.

Shopify-Disucssion-Help-Price-Range.jpg

 

 

0 Likes
pvoulg
Shopify Partner
165 25 44

Hi @torasaki,

You can try checking if your product only has a default variant, like so: 

{% if product.has_only_default_variant %}
{{ product.price | money_with_currency }}
{% elsif %}
..........
{% else %}
..........
{% endif %}

 

Inside the first statement you can also include another one, if product.compare_at_price > product.price, etc. in order to get all of the possible options you need. 

 

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
0 Likes