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.
Solved

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

tolgapaksoy
Shopify Partner
105 7 64

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

Accepted Solution (1)

Jesse_Vogt
Shopify Staff
14 2 10

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.

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Reply 1 (1)

Jesse_Vogt
Shopify Staff
14 2 10

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.

To learn more visit the Shopify Help Center or the Community Blog.