Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Cannot use graphql API metafieldSet for onlineStorePage and onlineStoreArticle

jam_chan
Shopify Partner
886 23 168

I try to use metafieldSet mutation but it doesn't work for onlineStorePage and onlineStoreArticle:

 

mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) {
  metafieldsSet(metafields: $metafields) {
    metafields {
      # Metafield fields
    }
    userErrors {
      field
      message
    }
  }
}
{
        "metafields": {
            "key": "test1",
            "namespace": "global",
            "ownerId": "gid://shopify/OnlineStorePage/6602811342925",
            "type": "single_line_text_field",
            "value": "123"
        }
    }

 

 

Return errors:

[{'message': 'invalid id', 'locations': [{'line': 2, 'column': 5}], 'path': ['metafieldsSet']}]

 

When I try to change the ownerId to 

I try to use metafieldSet but it doesn't work for onlineStorePage and onlineStoreArticle

 

When I try to change the ownerId to "gid://shopify/Product/1234", it works again. Why doesn't it support these 2 resources?

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
Replies 3 (3)

acerill
Shopify Partner
12 1 8

It looks like metafieldsSet does not work for the following 3 ID formats. Is it a bug? Or should the format of these ID's be different?

gid://shopify/OnlineStoreBlog/xxx
gid://shopify/OnlineStoreArticle/xxx
gid://shopify/OnlineStorePage/xxx

 Thanks

fzoccara_sintra
Shopify Partner
3 0 3

Try with newer api versions, I'd the same issues with company gid and using 2023-01 api version I make my day!

von_court
Shopify Partner
1 0 0

OnlineStorePage still not working with 2023-04, error response persists.

Used the REST API instead.