What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

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

Solved

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

tolgapaksoy
Shopify Partner
112 7 75

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.