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.

Post multiple Metafields with one call into Shop

Post multiple Metafields with one call into Shop

Sandor
Excursionist
17 2 0

Hello, everybody,
I need a little help, for an app I want to keep data in the Metafields Shop, how can I create several Metafields with one post, like for example with products?

Thanks a lot

Replies 3 (3)

Gregarican
Shopify Partner
1033 86 292

I see where we can query the shop metafields, like this. But not where there's any mutation to add/modify them?

{
  shop {
    id
    metafields(first: 5) {
      edges {
        node {
          id
          namespace
          key
          value
          valueType
        }
      }
    }
  }
}
Sandor
Excursionist
17 2 0

Hello Greg_Quawa,
reading the metafields is no problem with this query. The question is how I can create several at once.

Gregarican
Shopify Partner
1033 86 292

I don't see any way to create a single Metafield value in the Shop endpoint, much less a series of them. If you look at the Shopify GraphQL API documentation the Shop endpoint isn't listed as having mutations available. So, unless a Shopify staffer can comment differently, I don't think you can.