Development discussions around Shopify APIs
Return management just got easier! We’ve launched Customer Self-Serve Returns to all Shopify merchants. Click here to learn more!
I'm using a GraphQL client that automatically generates structures based on the GraphQL schema.
This part of the schema (https://shopify.dev/docs/admin-api/graphql/reference/mutation/input-object/orderinput?api[version]=2...😞
{
"kind": "INPUT_OBJECT",
"name": "OrderInput",
"description": "Specifies the information to be updated on the requested order.",
"enumValues": null,
"fields": null,
"inputFields": [
{
"defaultValue": null,
"description": "The email address associated with the order.",
"name": "email",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
... and other fields
],
"interfaces": null,
"possibleTypes": null
}
Generates the following:
struct OrderInput {
email: Option<String>,
... and other fields
}
When the email is unspecified (email is not among the fields I want to update), the GraphQL client serializes this as {"email":null, ...and other fields}.
As it turns out, the current behaviour of Shopify is that when receiving such a request, it will remove the email from the order. That does not seem to be the case for the shipping address (does not do anything and does not trigger an error), and I'm not sure about what it does on customAttributes, metafields and note.
I have three questions:
- Shouldn't it instead avoid removing the email when receiving null in this update, and remove it only when receiving an empty string ?
- Would the way I'm currently calling this endpoing also remove customAttributes, metafields and note if they were initially non empty on the order ?
- What would you suggest to avoid accidentally clearing other fields when calling this endpoint ?
User | RANK |
---|---|
16 | |
7 | |
6 | |
6 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022