Display highest price in collection page - Dawn theme

Solved

Display highest price in collection page - Dawn theme

Sabine_BabelB
Tourist
3 0 1

Hi there, I am looking to replace lowest prices in Collection pages to highest prices.

 

I sell secondhand books, with three pricing for each book depending on the book condition. Collection pages display the lowest prices (well-read books) but we have a majority of books in very good condition, at higher prices. The difference is not significant, usually around $1, but visitors can be annoyed to see a price on the collection page which is not what they find when clicking on the product page.

 

I have tried fiddling with the code in:

product-price.liquid,

product-price-listing.liquid,

 

and content in the from_lowest_price_htlm

 

to no avail. 

 

Your help is welcome, thank you!

Accepted Solution (1)
AcidPi
Shopify Partner
61 14 17

This is an accepted solution.

Hi,


Yeah its a bit different... I was able to get Debut (17.14.1) from GitHub.

Change the following in product-price-listing.liquid.

From @line12 - @line29

 

{%- liquid
  if product.title
    assign compare_at_price = product.compare_at_price
    assign price = product.price
    assign available = product.available
    assign variant = product.variants.first
  else
    assign compare_at_price = 1999
    assign price = 1999
    assign available = true
  endif

  if settings.currency_code_enabled
    assign money_price = price | money_with_currency
  else
    assign money_price = price | money
  endif
-%}

 

 

To @line12 - @line36

 

{%- liquid
  if product.title
    assign compare_at_price = product.compare_at_price
    assign price = product.price
    assign price_max = product.price_max
    assign available = product.available
    assign variant = product.variants.first
  else
    assign compare_at_price = 1999
    assign price = 1999
    assign available = true
  endif

  if settings.currency_code_enabled
    assign money_price = price | money_with_currency
    assign money_price_max = price_max | money_with_currency
  else
    assign money_price = price | money
    assign money_price_max = price_max | money
  endif

  if product.price_varies
    assign money_price = money_price_max
  endif
-%}

 

 

Tested briefly and seems to work as expected in collection page and search results.

However please note that this liquid file handles other prices; price__regular, price__sale, price__compare and price__unit - cant confirm that price__sale wont have issues in the future as i have not tested.


It shouldn't be an issue for structured data either as Shopify and this template are not providing price structured data via the Collection Page. You can check with the following tools.
https://validator.schema.org
https://search.google.com/test/rich-results

Structured Data Schema's
https://schema.org/CollectionPage
https://schema.org/Product


Regards.

View solution in original post

Replies 9 (9)

AcidPi
Shopify Partner
61 14 17

Hi,

Change the following in price.liquid from money_price to money_price_max

This is only used when the product.price_varies.


Capture 444.PNG

 

Regards

Sabine_BabelB
Tourist
3 0 1

Hi There, thank you for suggesting this solution so quickly. I made a mistake as the theme I am using is Debut (17.1.0) and not Dawn - apologies for that! The proposed solution doesn't quite work with Debut as the price.liquid file has a different content. Would you have a solution for Debut?

Regards,

AcidPi
Shopify Partner
61 14 17

This is an accepted solution.

Hi,


Yeah its a bit different... I was able to get Debut (17.14.1) from GitHub.

Change the following in product-price-listing.liquid.

From @line12 - @line29

 

{%- liquid
  if product.title
    assign compare_at_price = product.compare_at_price
    assign price = product.price
    assign available = product.available
    assign variant = product.variants.first
  else
    assign compare_at_price = 1999
    assign price = 1999
    assign available = true
  endif

  if settings.currency_code_enabled
    assign money_price = price | money_with_currency
  else
    assign money_price = price | money
  endif
-%}

 

 

To @line12 - @line36

 

{%- liquid
  if product.title
    assign compare_at_price = product.compare_at_price
    assign price = product.price
    assign price_max = product.price_max
    assign available = product.available
    assign variant = product.variants.first
  else
    assign compare_at_price = 1999
    assign price = 1999
    assign available = true
  endif

  if settings.currency_code_enabled
    assign money_price = price | money_with_currency
    assign money_price_max = price_max | money_with_currency
  else
    assign money_price = price | money
    assign money_price_max = price_max | money
  endif

  if product.price_varies
    assign money_price = money_price_max
  endif
-%}

 

 

Tested briefly and seems to work as expected in collection page and search results.

However please note that this liquid file handles other prices; price__regular, price__sale, price__compare and price__unit - cant confirm that price__sale wont have issues in the future as i have not tested.


It shouldn't be an issue for structured data either as Shopify and this template are not providing price structured data via the Collection Page. You can check with the following tools.
https://validator.schema.org
https://search.google.com/test/rich-results

Structured Data Schema's
https://schema.org/CollectionPage
https://schema.org/Product


Regards.

bryan76
Navigator
421 9 88

I would not do this.  that not only changes the collection page but how the price is displayed in general for any system fetching data.  

AcidPi
Shopify Partner
61 14 17

Hi,

Can you explain further, what systems fetching data are you referring to?

This suggestion modifies the price in two places collection and search results only when the product has varied pricing, how is showing the highest price in the collection page any different to showing the lowest price when the end product and product page is not being modified and still shows the varied pricing.

 

Regards

bryan76
Navigator
421 9 88

google, microsoft, all advertising platforms, etc. pull the pricing as 'from' as the lowest.  you could try it and see if you get errors or not.  

AcidPi
Shopify Partner
61 14 17

Hi,


I could not find any mention of using 'from' as an indicator for pulling the lowest price for google shopping/google ads etc, of course other advertising platforms or product scrapers could use that... do you have any links to this information?

Ive used "From: $low", "From $high", "From $high to $low" and "From $low To $high" pricing displayed in product category's for 10+ years and never had any errors or issues with pulling/updating data for external services as that came from the final product landing page or supplied data, anyway appreciate your reply - have a nice day/evening 🙂 

Regards

Sabine_BabelB
Tourist
3 0 1

Thank you - I had to tweak the code a bit since lines 12 to 29 differ in my template but it now works on the collection page! Will check the tools you mentioned as well. Very grateful for your help.

bryan76
Navigator
421 9 88

that information is pulled from the structured data of the product page.  you could change the word 'from' to something else but not sure how you would pull the highest price.  not an easy change and messing with the structured data could cause some serious problems as that is pulled by google for search results, advertising platforms, etc