FROM CACHE - en_header

how can i access best selling through the public api

ceaser123
New Member
1 0 0

 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

Reply 1 (1)
c10s
Shopify Partner
67 12 16

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.