Changing Display Price in Collections

Highlighted
New Member
2 0 0

Hi! I'm using the Debut theme and am looking for a solution to display a specific price when viewing the Collection page. Right now, the price displayed is the lowest one but I would like to change it to the price of the first product variant. I've searched for solutions but the codes that I've found are only for showing either the lowest or highest price. With my products, I have three variants with three different prices and I would like to show the price between the lowest and the highest. While trying to figure this out, I found that at the product-price.liquid portion, you can add either variant.price_min or variant.price_max with the coding below. But how do I specify the pricing for a certain variant?

 {%- assign price = variant.price -%}

 

0 Likes
Highlighted
Explorer
83 0 26

Hi there,

If all of your products have three variants you can do the following to show the middle variant price:

{%- assign price = product.variants[1].price -%}

variants[1] is the index for your second variant as with development indexes start at 0

1 Like
Highlighted
New Member
2 0 0

Hi!

Thank you so much for your reply! This resolved my issue and I am very grateful. :)

0 Likes
Highlighted
New Member
1 0 0

Hi,

I understand this thread is now a few years old, the codes works and displays the 2nd variant price however it removes the decimal point in the price for examples £65.00 becomes £6500

Can anyone help get the decimal point back please?





Screenshot 2020-08-07 at 18.04.43.png


0 Likes