Hi everyone,
I’ve run into an issue with product variant metafields in GraphQL.
- When I query via Admin API, the metafield returns the expected value.
- When I query via Storefront API, the same metafield is always
null
. - What’s strange is that this only started happening recently – before that, I was able to fetch the metafield value in Storefront API without any problems.
Admin API query
query {
nodes(ids: ["gid://shopify/Product/1234567890"]) {
... on Product {
variants(first: 5) {
nodes {
id
title
metafield(namespace: "custom", key: "extra_info") {
value
}
}
}
}
}
}
Admin API result
{
"id": "gid://shopify/ProductVariant/1111",
"title": "Sample Variant",
"metafield": {
"value": "{\"foo\":\"bar\"}"
}
}
Storefront API query
query {
nodes(ids: ["gid://shopify/Product/1234567890"]) {
... on Product {
variants(first: 5) {
nodes {
id
title
metafield(namespace: "custom", key: "extra_info") {
value
}
}
}
}
}
}
Storefront API result (same variant)
{
"id": "gid://shopify/ProductVariant/1111",
"title": "Sample Variant",
"metafield": null
}
Question:
- Why does this metafield show up in Admin API but return
null
in Storefront API now, even though it used to work before? - Has something changed recently that could cause this behavior?
Thanks!