Copy link to clipboard
Copied
Hi guys,
I am trying to have a "Sort by price (high to low)" and "Sort by price (low to high)" buttons on my website and having difficulty outputting the correct liquid code to do this. Can someone else?
By default, the page will display the products by name, and I was thinking of adding buttons which add to the URL "?sort=price-high-to-low" which I can then output the data using:
{% for items in products.item %}
{% if globals.get.sort = 'price-high-to-low' %}
<li>{{item.name}}</li>
{% endif %}
{% endfor %}
How do I then sort the outputted data by price? and price descending?
I am currently using:
{tag_productlist,1,,100,,true,collection="products" template=""}
{tag_productlist,1,,100,price,true,collection="products" template=""} -> outputs exactly what I want, but how to get this working with Liquid?
Appreciate the help!