Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Accessing Metafield data through admin api

Accessing Metafield data through admin api

CalebV
Shopify Partner
15 0 5

Hello. I'm developing a custom app for a shopify store and I am trying to access the metafields for each product. I understand that you can access them for individual resources but the feature I am working on would require me to have the metafield data accessible for all products retrieved from the Admin Rest API much like the product is and other object properties. Am I missing something or should I try a different route? This is by far the biggest hurdle for me building this custom app.

Replies 3 (3)

richard-penner
Shopify Staff
19 2 6

Hi CalebV! You can think of product metafields as regular product attributes, in the sense that you would fetch them alongside the products. For example, the `products` GraphQL query allows you to specify a `metafield` field, or use the `metafieldsByIdentifiers` field. How are you fetching the products?

To learn more visit the Shopify Help Center or the Community Blog.

CalebV
Shopify Partner
15 0 5

Through the REST admin api. I don’t have any experience with GraphQL 

richard-penner
Shopify Staff
19 2 6

Got it. In this case the REST metafields API is indeed a bit limited for what you are trying to do. I would highly recommend you trying out GraphQL for your use case – you can pull down all products and the desired metafields through a paginated list, all in one query. 

To learn more visit the Shopify Help Center or the Community Blog.