sort by price not working as intended

Topic summary

A user modified their Trade theme to display the maximum variant price instead of the minimum price on product listings. However, this change broke the collection sorting functionality—when sorting by highest price, products now sort based on their cheapest variant rather than the displayed maximum price.

Original Fix Applied:

  • Modified price.liquid to change t: price: money_price to t: price: money_price_max
  • Successfully displays the highest variant price on product cards

Current Problem:

  • Sorting by price (ascending/descending) still uses minimum variant prices
  • Results in incorrect product order (e.g., $90 items appearing before $200 items when sorted high-to-low)

Proposed Solution:
A support representative suggested modifying collection sorting code to use price_max instead of price in files like collection.liquid or sorting-related snippets. However, the user cannot locate the suggested code patterns in their theme files, only finding main-collection-product-grid.liquid without matching syntax.

The discussion remains unresolved, with the support representative offering to directly access and fix the theme code for free via collaborator access.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Im using Trade theme

let me start with the thing that started all of this, I had multiple variants on a item and it was showing the cheapest option instead of the main price when viewing items so i found a guide and fixxed that issue which was to do

Online Store > Themes > Edit code > search for “price.liquid”
then proceed to find this line

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

then change

t: price: money_price

to

t: price: money_price_max

but now when i sort by highest price in the product grid its going off the cheapest variant instead of the actual so the top rows there are $90 products displayed but if you scroll to row 3 theres randomly $200 prices listest

Hey @Atlas_0ne

Based on your issue, it sounds like you’ve fixed the display of prices in the product grid, but now the sorting functionality in your collection grid is not working correctly. This is because your theme is still using the default price for sorting rather than the maximum price.
Here’s how to fix the sorting issue:

  • Go to your Shopify admin
  • Navigate to Online Store > Themes
  • Click “Edit code” on your Trade theme
    Look for the file that handles collection sorting. This is typically in one of these files:

collection.liquid
collection-template.liquid
Or possibly in a file inside the snippets folder related to sorting or collection grids

Search for code related to sorting or price sorting. Look for something like:

{% assign sorted_products = collection.products | sort: 'price' %}

or

{% when 'price-descending' %}
{% assign sorted_products = collection.products | sort: 'price' | reverse %}

Change the sort parameter from ‘price’ to ‘price_max’ like this:

{% when 'price-descending' %}
{% assign sorted_products = collection.products | sort: 'price_max' | reverse %}

Make the same change for the ‘price-ascending’ sort option if it exists.
Save your changes.

This modification should make your collection grid sort by the maximum variant price instead of the default (minimum) price, which will match the prices you’re now displaying on your product grid.

Feel free to give it a try on your end, and if you need any help, just send us your collaborator code via DM or email. We’ll gladly make the necessary changes for you for free. Looking forward to assisting you! :blush:

Cheers,
Shreya

i do not seem to have any of the .liquid files the only thing i can find refencing sorting is in main-collection-product-grid.liquid and im not seeing anything similar to {% assign sorted_products = collection.products | sort: ‘price’ %}

Will it be fine if I can have a look at your theme code and fix it for free? Would be willing to DM or email your collaborators code?