GraphQL 2021-07 Order update metafield bug: can't use new "type" field

Solved
tolgapaksoy
Shopify Partner
73 5 40

I'm using the 2021-07 API. I'm trying to use the new Metafield "type" field on my Orders. The schema does not complain at all, but the mutation returns an error:

 

  mutation AddOisIdMetafield($id: ID!, $uuid: String!) {
    orderUpdate(
      input: {
        id: $id
        metafields: [
          {
            key: "orderId"
            namespace: "ois"
            value: $uuid
            type: "single_line_text_field"
          }
        ]
      }
    ) {
      order {
        tags
        metafield(key: "orderId", namespace: "ois") {
          value
          namespace
          type
        }
      }
      userErrors {
        field
        message
      }
    }
  }

 

These are the variables:

 

{
	"id": "gid://shopify/Order/3944892137635",
	"uuid": "737db960-d975-4aa2-a5c7-54234f8c440d"
}

 

And this is what the API returns:

 

{
  "data": {
    "orderUpdate": {
      "order": {
        "tags": [],
        "metafield": null
      },
      "userErrors": [
        {
          "field": [
            "metafields",
            "0",
            "valueType"
          ],
          "message": "Value type is not included in the list"
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 11,
      "actualQueryCost": 11,
      "throttleStatus": {
        "maximumAvailable": 1000.0,
        "currentlyAvailable": 989,
        "restoreRate": 50.0
      }
    }
  }
}

 

The "valueType" field is deprecated and even removed from the schema, so I can't pass that to the mutation. But the API seems to do a presence validation on a deprecated/removed field. Can anyone from staff take a look at this? It's really confusing me.

Request ID: 663ae079-b1ce-4bc3-a85e-2d36c780c2f7

0 Likes
Jesse_Vogt
Shopify Staff
Shopify Staff
1 1 0

This is an accepted solution.

Thanks for letting us know about this and I verified that this is an issue. While a fix is being worked on you should be able to use `valueType: STRING`. In 2021-07 it is deprecated but should still be available.

0 Likes