Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I have products that need to show a range of prices based on the option that they choose.
Medium armored shirt is $193
A Medium un-armored shirt is $93
3XL shirt armored is $209
A 3XL un-armored shirt is $109
I want the price on the product page to be a range of $93-209 but I do not see any way to do this without having to install an app and I worry the apps may not play well with others.
Any help would be great.
Solved! Go to the solution
This is an accepted solution.
Hi @KLC
The simple code I can think about is using map and sort. And I assume you are using theme with custom liquid enable to make it simpler to add. Please follow the instructions below.
{% assign price_range = product.variants | map: "price" | sort %}
{{ price_range.first | money }} - {{ price_range.last | money }}
See image for reference:
This is an accepted solution.
Hi @KLC
The simple code I can think about is using map and sort. And I assume you are using theme with custom liquid enable to make it simpler to add. Please follow the instructions below.
{% assign price_range = product.variants | map: "price" | sort %}
{{ price_range.first | money }} - {{ price_range.last | money }}
See image for reference:
WOW, awesome!!! Thank you very much. 🙂
That's great! Any advice on how to make it hide on products that don't have a price variant? Thank you.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024