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.

Re: Metafield gid keeps changing!

Metafield gid keeps changing!

mattayres
Shopify Partner
11 0 8

Hi guys I am using :

 

{
product(id: "gid://shopify/Product/6806329950293") {
availablePublicationCount


metafields(first: 5) {
edges {
node {
id
key
value
description
}
}
}

}
}

 

And the gid for the metafield keeps changing!:

 

"metafields": {
"edges": [
{
"node": {
"id": "gid://shopify/Metafield/20662215409749",

 

This is obviously making it impossible for me to perform Product Update mutations!

 

I am not sure what is causing this gid for the metafields to change randomly... its done it about 3 times now throughout the day.

 

Surely once that metafield is created the gid is set in stone!?

Replies 3 (3)

jazz-jay
Shopify Partner
96 14 17

Hi,

 

To update a product metafield, here is normally what should be done:

  1. Get the products metafields filter it by namespace and/or key
  2. Once you get the correct metafield (filtered by key and namespace), then use the gid of that metafield to do the update
banned
mattayres
Shopify Partner
11 0 8

Lol wow.

 

OK.. Is there some good reason for having constantly random changing gid's for metafields.?  This has just made the process of updating a few thousand products with hundreds of metafields 10 times harder 😞

jazz-jay
Shopify Partner
96 14 17

Oh well,

 

I don't know, shopify has designed it that way.

banned