A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi Shopify team!
I am Charly, Lead Engineer of the Shopify Plugin of Algolia (https://community.algolia.com/shopify/)
Our product relies heavily on the Shopify GraphQL API in order to index data in our search engine.
We are currently facing issues with the following query:
query resource_metafields($id: ID!) { product(id: $id) { metafield_0: metafield(namespace: "algolia", key: "grouping") { key namespace value } metafield_1: metafield(namespace: "color_filters", key: "images") { key namespace value } metafield_2: metafield(namespace: "multiwarehouse", key: "canonical") { key namespace value } metafield_3: metafield(namespace: "translate", key: "en-CA") { key namespace value } } }
For product that have a value for metafield_0, the API is returning `null`
We have this bug impacting more than 50 customers right (over different and many metafields) and we had to rollback to the REST API.
I saw that a similar issue was raised on Collections recently: https://community.shopify.com/c/Shopify-APIs-SDKs/GraphQL-Cant-get-metafield-for-collection/td-p/556...
We plan to stop using `Product.metafield` and use `Product.metafields` instead, can you guarantee that we will not face the same issue by using the following query?
query resource_metafields($id: ID!) { product(id: $id) { metafields(first: 100) { edges { node { key namespace value } } } } }
Thank you for your time!
Solved! Go to the solution
This is an accepted solution.
Hello charlypoly,
We have understand your query so for that please go throgh below link to get more details what is wrong:
https://help.shopify.com/en/api/guides/metafields/admin-api-metafields#retrieving-metafields
:
This is an accepted solution.
Hello charlypoly,
We have understand your query so for that please go throgh below link to get more details what is wrong:
https://help.shopify.com/en/api/guides/metafields/admin-api-metafields#retrieving-metafields
:
Hello @charlypoly ,
Are you able to confirm if this issue is still ongoing? I just ran the following query and I was not able to replicate this :
{ product(id: "gid://shopify/Product/1969403592760") { metafield_0: metafield(namespace: "google", key: "test") { key namespace value } metafield_1: metafield(namespace: "testmetafield", key: "warehouse") { key namespace value } } }
Josh | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi @Josh ,
Thanks for replying.
In fact the issue was on our side, we were trying to get Variant metafields instead of Product metafields.
Sorry for the misunderstanding and thanks for the support!
Have a nice day,