Shopify/storefront-api-examples

GraphQL error: metafields doesn't exist on type 'Product'

lapidus opened this issue · 5 comments

How can I retrieve metafields for a product using the Storefront API?

Metafields are not exposed though the storefront API. You'll need to supplement your functionality with the admin API, if you'd like to take advantage of them.

Why aren't metafields exposed through the storefront API?

Because they contain a mix of public and private data and there’s no way to differentiate. Were they exposed, wed be sharing possibly private data on many shops.

Because they contain a mix of public and private data and there’s no way to differentiate. Were they exposed, wed be sharing possibly private data on many shops.

It would be nice if this was added to the Storefront API docs.

(For reference the Admin API is a really nice GraphQL API.)

I know this post is old, but for people coming through later, you can access metafields if you whitelist them. See here