FROM CACHE - en_header
Return management just got easier! We’ve launched Customer Self-Serve Returns to all Shopify merchants. Click here to learn more!

Changing the price variant from lowest to highest on collections with Dawn Theme

Stephanosss02x
New Member
1 0 0

Hi everyone.

 

I'm trying to change the price variant display from lowest to highest on the collections.

 

I managed to disable the prices on my collections for now until I resolve the issue.

 

I know a few things about coding "not much" but I would be able to comprehend the instructions given to me.

 

I'm using the Dawn Theme, if that helps of course as I'm sure they're all different.

 

Edit: Let me know if the coding files are needed.

 

Thank you in advance 🙂

 

Stephanos

cto@cyprusinthesunholidays.com

 

 

Reply 1 (1)
Niyeepo
Excursionist
201 14 24

@Stephanosss02x  

To change the price variant display from lowest to highest on your collections using the Dawn Theme, you will need to edit the liquid code. Specifically, you will need to find the code that controls the sorting of the variants and modify it to sort by price in ascending order.

Here is an example of code that you can use to sort your variants by price:


{% for product in collection.products %}
{% assign sorted_variants = product.variants | sort: 'price' %}
{% for variant in sorted_variants %}
{{ variant.title }} - {{ variant.price | money }}
{% endfor %}
{% endfor %}


This code uses the sort filter to sort the variants by the 'price' attribute in ascending order.

Please note that this is just a basic example and you may need to adjust the code to fit your specific use case and also make sure you backup your files before making any changes.

Please let me know if you need more help on this.

5diamond