I’m working on a custom store front for my shopify site and I’m using the Storefront API with GraphQL. I have a products page but I’m not able to sort by Price currently from the server.
Prices are not serialized on Product resources, so it would not make sense to provide the SortKey here. That said, the SortKey is not presently available on ProductVariants. It looks like price is not an indexed property, meaning it’s a much less performant query.
That said, feedback passed along. I can see why you’d want to do this. Thanks for posting!
Thanks for the response, Alex. I’m a developer myself so I understand the constraint. Any workarounds you would recommend for the time being? I don’t want to implement a sort on the client side because it would mess up pagination as I pull more products and I don’t want to pull every product for obvious performance reasons. Kind of stuck here. There is sorting by price on collectionsByHandle but there I don’t have the ability to query/filter. I want the best of both of those haha.
You could maybe make use of an application proxy in order to leverage the liquid engine from your back end if necessary, collect the output from there, and feed it into wherever you need it? Just a thought.