Getting only selected meta-fields with namespace and keys via admin Graphql API.

Getting only selected meta-fields with namespace and keys via admin Graphql API.

CodeForGhost
Visitor
1 0 0
metafields(
                    namespace: "custom"
                    first: 10
                ) {
                    edges {
                        node {
                            key
                            value
                        }
                    }
                }

I need to get only the selected fields in the metafields array. what should be the query for this? 
Can I use the "keys": ["field1", "field2", "field3"] as an argument in meta fields?
Reply 1 (1)

Kyle_liu
Shopify Partner
101 14 17

Hi @CodeForGhost 

 

The API you are using is no longer available. I have found an alternative, and the code is as follows

 

query: "key:rating OR key:rating_count"

 

query {
  metafieldDefinitions(first: 250, ownerType: PRODUCT, query: "key:rating OR key:rating_count") {
    edges {
      node {
        name
        key
      }
    }
  }
}

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on (liushuaicc@shinetechsoftware.com)