Storefront API returns null metafields with react-native

Solved

Storefront API returns null metafields with react-native

Wayne7
Shopify Partner
8 1 1

I can use this query in the Shopify graphQL App, but when I use in my headless channel with react-native, the metafields return null:

{
products(first: 10) {
edges {
node {
id
title
featuredImage {
url
altText
}
handle
metafields(
identifiers: [
{namespace: "global", key: "xxxxx_duration"},
{namespace: "global", key: "xxxxx_id"},
{namespace: "global", key: "circuit_1"},
{namespace: "global", key: "source_id"}
]
) {
namespace
key
value
}
}
}
}
}

Note: Actually metafield keys have been anonymized in this post.

 

I am trying to use API version 2024-04 and have NOT created a MetafieldStorefrontVisibility record manually, because it is deprecated and the metafields definitions all have 

 
Storefronts access

Definition is available in your Online Store, through Liquid, and the Storefront API option checked

 

which I think means the visibility should be set already.

 

Do I still need to manually create a MetafieldStorefrontVisibility record? 

 

If not, what am I doing wrong?

 

Thanks.

Accepted Solution (1)

Wayne7
Shopify Partner
8 1 1

This is an accepted solution.

If found the problem. I was testing against the wrong "store" My apologies.

View solution in original post

Reply 1 (1)

Wayne7
Shopify Partner
8 1 1

This is an accepted solution.

If found the problem. I was testing against the wrong "store" My apologies.