Possible bug: Recreated metafield's unexpected behaviour

Hi there,

I created metafields with the wrong type. I deleted those in the AdminUI and created new ones with the same name (so same namespace and key). When I insert values in those metafields via: v2024-10 -> bulkOperationRunMutation -> productSet I don’t see those values in the AdminUI, but when I query the metafields I see the values. But that is not all: when I set values in the metafield via AdminUI I don’t see them via GraphQL. The second time I created the metafields I changed some “limited values”, those new set of values are visible in the AdminUI.

Team Shopify Dev, any change you can look into this?

Have connected with the product team on this - will update here asap!

Hi,

I’m looking into this issue now. Would you be able to provide some additional information:

  1. Was there a definition created for the namespace/key?
  2. If so, were both the definition and metafields deleted in the Admin UI?
  3. If not, are you navigating to the unstructured metafields page to view the metafields created via GraphQL?
  4. Can you provide the mutation arguments being used for the creation of metafields that were not visible in the Admin UI?

Thank you!

Hi @N-Shopify ,

Thanks, for looking into this.

  1. Yes there where some products that had values in Target Ages.
  2. Yes, both in UI.

bulkMutation:

mutation BulkCreateCollection($stagedUploadPath: String!) {
  bulkOperationRunMutation(
    mutation: """
      mutation call($input: ProductSetInput!) {
        productSet(input: $input) {
          product {
            id
            title
            variants(first: 1) {
          edges {
            node {
              id
              inventoryItem {
                id
              }
            }
          }
        }
        metafield(namespace: "custom", key: "external_id") {
          id
          value
        }
          }
          userErrors {
            field
            message
          }
        }
      }
    """,
    stagedUploadPath: $stagedUploadPath
  ) {
    bulkOperation {
      id
      url
      status
    }
    userErrors {
      message
      field
    }
  }
}

Sample input:

{
  "input":
  {
    "collections":
    [
      "gid://shopify/Collection/111111111111",
      "gid://shopify/Collection/222222222222",
    ],
    "descriptionHtml": "Some really nice product to swim with sharks ;)",
    "files":
    [
      {
        "alt": "1111 | sharkswimmer",
        "contentType": "IMAGE",
        "duplicateResolutionMode": "APPEND_UUID",
        "filename": "1111-sharkswimmer.jpg",
        "originalSource": "https://exampleimage.com"
      }
    ],
    "tags": "TEST_BULK",
    "handle": "janod-gitaar-ukelele-53-cm-confetti",
    "metafields":
    [
      {
        "namespace": "custom",
        "key": "supplier_sku",
        "value": "shark_11111",
        "type": "single_line_text_field"
      },
      {
        "namespace": "custom",
        "key": "external_id",
        "value": "19495",
        "type": "number_integer"
      },
      {
        "namespace": "custom",
        "key": "ages",
        "value": "[\"3\",\"4\",\"5\",\"6\",\"7\",\"8\"]",
        "type": "list.single_line_text_field"
      }
    ],
    "seo":
    {
      "title": "sharkswimmer",
      "description": "Some really nice shark swimmer"
    },
    "title": "The sharkswimmer",
    "variants":
    [
      {
        "barcode": "111111111111",
        "price": "99.99",
        "sku": "1111",
        "taxable": true,
        "optionValues":
        [
          {
            "name": "Default Title",
            "optionName": "Title"
          }
        ]
      }
    ],
    "status": "ACTIVE",
    "productOptions":
    [
      {
        "name": "Title",
        "values":
        [
          {
            "name": "Default Title"
          }
        ]
      }
    ]
  }
}

Hi @AdminGh,

Some additional questions for you.

  1. Are you creating definitions through the API after you’ve deleted the definition and metafield in the Admin UI?
  2. Where in the Admin UI are you checking for the metafields created through the API?
  3. When settings metafields via the Admin UI what query are you using to see them in GraphQL?