Hi, I’ve shopify e-commerce. I want to create a page that displays products with sorting options. I want to sort by title, price, vendor, most frequently bought. So the options will looks like this :
- Product Name A-Z
- Product Name Z-A
- Price Lowest to highest
- Price Highest to lowest
- Brand A-Z
- Brand Z-A
- Most Frequently Bought
I get data from the graphql API : “/admin/api/2021-04/graphql.json”
So, what I’m asking is how to sort by price ? I’ve try to make request to graphql API like this :
as you can see that I got an error
Argument ‘sortKey’ on Field ‘products’ has an invalid value (PRICE). Expected type ‘ProductSortKeys’.
And then I open the productsortkeys documentation in here https://shopify.dev/docs/storefront-api/reference/products/productsortkeys, it said that we can sort by price.
As you can see, I also use the same API version (2021-04)
How come the API is different with the documentation ???
And then my second question is, how can I sort product by “Most Frequently Bought” ?
I think that is standard features of e-commerce.
Thank you very much !

