All things Shopify and commerce
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
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.
User | RANK |
---|---|
69 | |
49 | |
36 | |
34 | |
29 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022