Metafields array for products returning null graphql

Topic summary

A developer is encountering issues retrieving product metafields via Shopify’s Storefront GraphQL API, with queries returning null values instead of expected data.

Core Problem:

  • GraphQL query for product metafields (using namespace “custom” and key “test”) returns null
  • When attempting to enable “access on storefront” for metafields, the system requires name and description fields to be filled
  • Cannot select “product” as a metafield type—only text, decimal, or numeric options are available (product type only appears when creating new metafields)

Technical Context:

  • Using Storefront API (not Admin GraphQL API)
  • Query retrieves multiple products across collections in a single request
  • Metafields use identifiers parameter with namespace and key
  • Cannot hardcode each namespace since they need all metafields across multiple products

Current Status:

  • Issue remains unresolved
  • Developer confirmed they’re working with the Storefront API specifically
  • Liam suggested adding required name/description fields, but this didn’t resolve the product type selection limitation
Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

We have a graphql that gets a list of products and collections from the shopfiy products and collections.

We have custom data set up, the metafields we have are not defined but they have a namespace and key.

When i go check the ‘access on storefront’ it requires the name and description to be filled, I’m not able to select product only text, number or decimal.

I’ve attached our query and what we are getting back

export const GET_PRODUCTS_FOR_COLLECTION_IDS = gq1*> > shopity> > query GetProductsForCollections($ids: [ID! ]!) {> > nodes (ids: $ids) {> > on Collection {> > products(first: 25) {> > edges {> > node {> > title description> > images (first: 2) {> > edges {> > node {> > src> > }> > metafields(identifiers: [> > {namespace: “custom”, key: “test”),> > ]) {> > id value> > }> > variants(first: 1) {> > edges {> > node {> > id price> > }> }> }

Response

description:> > “A 12” by 8" portrait. No mount included. test’> > J> > images: Array (1), metafields: Array (1), …]> > description: "A 12" by 8" portrait. No mount included. tes> > • images: Array (1)> Do: {_ typename:> > ‘Image’, sre: 'https://cdn.shopify.com/s/f> > length: 1> > - [ [Prototype]]: Array(0)> - metafields: Array (1)> > 0: null length: 1> > • [ [Prototype]]: Array (0)> > title: “12"×8" Portrait (no mount)” ~ variants: Array (1)> > - 0:> id: “gid://shopify/ProductVariant/39845834096810” price: “8.75”> _typename: “ProductVariant”> - [ [Prototype]]: Object length: 1> - [ [Prototype]]: Array (0)> typename: “Product”> - [[Prototype]]: Object> - constructor: f Object ()> - hasOwnProperty: f hasOwnProperty ()> - isPrototypeOf: f isPrototypeof()> - propertyIsEnumerable: f propertyIsEnumerable()> - toLocaleString: f toLocaleString ()> - toString: f toString()> - valuedf: f valuedf()> defineGetter> > f> > defineGetter> > _ ( )

Hi KrisAP, I think this issue is happening because a name and description must be provided when defining your metafield. These fields can’t be left empty and it’s a Shopify requirement. Can you add these in and try again?

Hi Liam!
Thank you for your reply.

We have tried adding this but we are unable to change them to product. Our only options are text, decimal or numeric, we only have the option of selecting a product if we create a new metafield.

We are trying to get all of the products we have on the store via the graphql query.

Our graphql endpoint was the 2021 version. When I look at the shopify graphql api online it says that metafields for pagination is no longer supported. I believe this is what we were using. The other day our code crashed and now we have to use metafields with identifiers and namespaces. But we cannot do this as we need to get all metafields for multiple products in a single query. We can’t hardcode each namespace in as we need all of them, not just a single one. On the api for graphql the only supported queries for metafields are those with namespaces and identifiers.

Apologies we’re using the storefront api, not graphql api.