Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

how to query shopify collections data according to metafields key and value using admin graphql api

how to query shopify collections data according to metafields key and value using admin graphql api

AmitIntuji
Shopify Partner
3 0 0

i am having trouble getting collection in respect to metafields key or value

 

query GetCollections{
  	collections(first:20, query: "metafields:namespace.key='parent'" ){
      nodes{
        id
        handle
        title
        metafields(first:10){
          nodes{
            key
            value
            namespace
          }
        }
      }
    }
}

 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 524

Hey @AmitIntuji

 

Looking over our documentation here, `metafields` is not an available filter query on collections. 

 

You can see the available filters here:  https://shopify.dev/docs/api/admin-graphql/2024-01/queries/collections#argument-collections-query 

 

The unstable API version does have a metafields query. There's an example here on retrieving metafields within a namespace.  

 

Hope that helps! 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog