How to sort products by highest price variant on my ecommerce site?

Hey folks,

I have opened a shop https://thistletavern.com/collections/all however the issue I have is that when sorting by “price, high to low” the results are returned using the lowest variant price.

I’ve been able to sort the theme code (Dawn) to return the highest variant price, and then sort that particular page high to low on the collections page (code reverted for now)

The problem is still that the results from the server have been pulled using the lowest-price variant so the changes to the theme only effect the 20 results on the page i.e. the first result of page 2 is a higher price than the last entry on page 1.

Has anyone seen an app that would allow for the sort by price to look at the highest price variant before it’s returned to the frontend for sorting?