ProductSet mutation no longer updates or deletes metafields

Hi everyone,

I’ve encountered a problem when working with metafields via the productSet mutation.

According to the Shopify documentation, the expected behavior is:

Any list field (e.g. collections, metafields, variants) will be updated so that all included entries are either created or updated, and all existing entries not included will be deleted.

This used to work exactly as described. However, since the update mentioned in this changelog:

ProductSet and CustomerSet mutations now support upserts

the behavior for metafields seems to have changed.

Now, it’s no longer possible to update existing metafield values or delete metafields using productSet. Only adding new metafields works.

:repeat_button: Steps to reproduce:

  1. I have a product with metafields.

Here’s the query I use to retrieve them:

{
  product(id: "gid://shopify/Product/9852689744211") {
    id
    metafields(first: 250) {
      nodes {
        namespace
        key
        value
        type
      }
    }
  }
}

The response shows the following metafields:

{
  "nodes": [
    {
      "namespace": "global",
      "key": "title_tag",
      "value": "RYOBI 18V ONE+™ 1 Gallon air compressork"
    },
    {
      "namespace": "dataease",
      "key": "title_tag",
      "value": "test"
    },
    {
      "namespace": "dataease2",
      "key": "title_tag",
      "value": "test2"
    },
    {
      "namespace": "app--181562114049",
      "key": "title_tag",
      "value": "upd-meta-value"
    }
  ]
}
  1. Now, I try to remove all metafields using productSet with the following mutation:
mutation productSetSynchronous($productSet: ProductSetInput!) {
  productSet(input: $productSet, synchronous: true) {
    product {
      id
      metafields(first: 250) {
        nodes {
          namespace
          key
          value
          type
        }
      }
    }
    userErrors {
      code
      field
      message
    }
  }
}

With these variables:

{
  "productSet": {
    "id": "gid://shopify/Product/9852689744211",
    "metafields": []
  }
}

The response:

{
  "productSet": {
    "product": {
      "metafields": {
        "nodes": [
          {
            "namespace": "global",
            "key": "title_tag",
            "value": "RYOBI 18V ONE+™ 1 Gallon air compressork"
          },
          {
            "namespace": "dataease",
            "key": "title_tag",
            "value": "test"
          },
          {
            "namespace": "dataease2",
            "key": "title_tag",
            "value": "test2"
          },
          {
            "namespace": "app--181562114049",
            "key": "title_tag",
            "value": "upd-meta-value"
          }
        ]
      }
    },
    "userErrors": []
  }
}

As you can see, the metafields remain unchanged.

Attempts to update existing metafields result in an error. Only adding new ones works.

Tested on API versions:

• 2025-04

• 2025-01

• 2024-10

:pushpin: My support request ID: x-request-id: 1f4c2f2f-2653-41c4-89bf-a8fdd47a89a0-1743956392

Has anyone else run into this issue?

Would appreciate any insight or confirmation :folded_hands:

1 Like

Hey @dataease_app :waving_hand: - I did a bit of digging into this on my end here, and I think this syntax should work for the mutation:

mutation RemoveAllProductMetafields($input: ProductSetInput!) {
  productSet(input: $input) {
    product {
      id
      metafields(first: 50) {
        edges {
          node {
            id
            namespace
            key
            value
            type
            createdAt
            updatedAt
          }
        }
        pageInfo {
          hasNextPage
          hasPreviousPage
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

Variables:

{
  "input": {
    "id": "gid://shopify/Product/product-id-here",  
    "metafields": []                          
  }
}

Defining “input” in the variables seemed to work for me - can you let me know if you encounter any other errors there? Hope this helps!

Hey Alan, thanks for getting back to me and taking the time to look into this :raising_hands:

Unfortunately, your suggestion didn’t resolve the issue on my end. I tried using the input definition exactly as in your example, but the result remains the same — metafields are neither deleted nor updated through the productSet mutation.

The only difference between your query and mine is the use of synchronous: true, which shouldn’t affect the core behavior of how metafields are handled.

Just to double-check, here’s my latest request ID for your reference:

x-request-id: df18baa0-34c9-4d5a-a3d3-5bce6f8ac539-1744135810

Let me know if you need any other details from my side. I’m happy to provide more examples or test cases if needed!

Thanks again :folded_hands:

No worries @dataease_app - you’re definitely right that the only difference on the input side seems to be the synchronous boolean value you’re applying there in your call. Thanks for sharing that second request ID there as well, gives me some insight on what is happening on the backend. I’ll do some more digging into this and loop back with you when I have a solution/next steps. :slight_smile:

Hey @dataease_app - just looping back here with you. We’re treating this as a possible issue on our end now after investigating further. I’ll be back in touch as soon as I have movement/next steps on this :slight_smile:

1 Like