Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi,
guys i have a simple react app and i want to access the last 5 best selling product through json request without using the admin api , after researching i found this enpoint https://example.net/products.json it gave me the last product, the question is how can i sort it by best selling or by price .
thank you
I don't know if you can do it with just /products.json but the Storefront API can do it:
{
products(first: 5, sortKey: BEST_SELLING) {
edges {
node {
title
}
}
}
}
ProductSortKeys docs.