We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: How To Change Price To Display Most Expensive Variant On Homepage/Collections Pages

How To Change Price To Display Most Expensive Variant On Homepage/Collections Pages

Baracuda99
Visitor
2 0 0

Hello. I need help in editing the code on my shop. I am using third party theme, but it's based on Down theme. 
I have a product that has variants. Right now the price displayed on the homepage and collection is the lowest price. I want to display the highest price.

Does anybody know how I can do it?

 

Site: catssecret.co
Password: Baracuda99

 

Now it's look like this:

Baracuda99_0-1686154155890.pngBaracuda99_1-1686154189865.pngBaracuda99_2-1686154209044.png

 

I need to show 100% Payment variant on home page and collections pages

Thank you

Replies 13 (13)

Moeed
Shopify Partner
7764 2082 2568

Hey @Baracuda99 

To display the products from Highest Price to Lowest Price on a collection, you need to Follow these Steps:

Follow these Steps:

1) Go to Products
2) Click on Collection
3) Open the Collection from where you want to show Highest to Lowest Price Products
4) Scroll down to the bottom and Sort the Products by choosing "Highest Price"
5) Click on Save

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed




- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


Baracuda99
Visitor
2 0 0

I mean the display of the product price.

Now it shows the price as "From 500", that is, the cheapest of all options.

I need the price of the most expensive option to be displayed on the main page and the collection page

Daisyc2
Visitor
1 0 0

Hi I need to do this too did you ever figure it out?

akbikes
Visitor
2 0 0

Any luck?

 

glowcreativenz
Shopify Partner
17 1 6

Edit: I replied to the wrong person, sorry. Hopefully we can find a solution though.

I'm keen to find the solution to this too. Have you figured it out?
I'll post here again if I find anything in my search.

Ashleigh
Web Designer | Shopify Partner
Glow Creative

Jahid-KlinKode
Excursionist
145 1 5

@Moeed, discover an easy solution for showcasing variant names and prices on Shopify collection pages in this YouTube video:

 

nikola123
Visitor
3 0 0

Nobody wants that

BGalloway
Tourist
5 0 1

This may not be exactly what you're attempting to do, but in the product-block.liquid code, my theme is using the following code to select the cheapest variant: 

{% assign cheapest_variant = product.variants | sort: 'price' | first %}

 

You could modify that logic to get the costliest_variant (or whatever you want to call it) by changing the "first" to "last" like below:

{% assign costliest_variant = product.variants | sort: 'price' | last %}

 

Then, where you ouptut the variant price in your template, use your new "costliest_variant" instead of the "cheapest_variant" or whatever variable is there now. For example: 

<div class="product-price">
  Up to: {{ costliest_variant.price | money }}
</div>

 

Hope that helps, cheers!

Brant

devtff
Visitor
3 0 0

Thanks Brant. For a Shopify code newb like me, how would I navigate to that piece of code?

glowcreativenz
Shopify Partner
17 1 6

I'm keen to find the solution to this too. Have you figured it out?
I'll post here again if I find anything in my search.

Ashleigh
Web Designer | Shopify Partner
Glow Creative
LezzeriFran
Tourist
17 0 1

Hey, this wasn't working for me either. 

I found a solution that worked here https://stackoverflow.com/questions/70671965/shopify-dawn-theme-show-max-variant-price-on-featured-c...

Fleetwood
Visitor
1 0 0

Thanks! This worked for me. It did two things: 1) displays my higher price (default product)     2) removed the From text so only the price shows. 

CardFatherGames
Visitor
1 0 0

I figured this out! FYI

 

You'd have to find the coding that's responsible for showing the prices on your collection pages, and then edit the "money_price" value to be "money_price_max" ... so that it shows the most expensive variant price on your collection pages, instead of the cheapest variant price (which is the default). 

 

Generally this would be under the Price.Liquid 

You're looking for - 

if target == product and product.price_varies
assign money_price = 'products.product.price.from_price_html' | t: price: money_price
endif

Change to  -

if target == product and product.price_varies
assign money_price = 'products.product.price.from_price_html' | t: price: money_price_max
endif

 

Refresh the site