Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Storefront api to get collection's sort_order: ""

mani_HL
Shopify Partner
5 0 2

Hi there,

Hope someone can help me here, we are building a custom storefront with Nextjs. 

Question - With collectionByHandle query can I able to get the sort_order ? We use different sort option for different collections, How can I find out which collection have which sort has been selected as default?

 

mani_HL_0-1634096201548.png

 

Query I am using to collection products, here best_selling is hard coded, I would need to make it dynamic based on sort type selected on the Admin

query InStock($product_filters: [ProductFilter!])  {
  collectionByHandle(handle"diet-and-sports-nutrition") {
    handle      
  sort_value
    products(first10,filters$product_filterssortKey:BEST_SELLING ) {
      edges {
        node {
          handle
          availableForSale
          productType
          vendor
          totalInventory
         
        }
      }
    }
  }
}
Replies 0 (0)