cwtart
1
Shopify GraphQL - trying to create a fulfillment for an entire order at one time
json sent:
{
“fulfillment”: {
“lineItemsByFulfillmentOrder”: [
{
“fulfillmentOrderId”: “gid://shopify/FulfillmentOrder/7193976766744”,
“fulfillmentOrderLineItems”:
}
],
“notifyCustomer”: false,
“trackingInfo”: {
“company”: “USPS”,
“number”: “9400136105522289413023”
}
}
}
returned error message:
{“errors”:{“query”:“Required parameter missing or invalid”}}
What am I doing wrong?
cwtart
2
By the way, this works using REST instead of GraphQL
code is shown below:
URL = https://store_name_here.myshopify.com/admin/api/2024-10/fulfillments.json
json sent:
{
“fulfillment”: {
“line_items_by_fulfillment_order”: [
{
“fulfillment_order_id”: “7193725174040”
}
],
“tracking_info”: {
“company”: “USPS”,
“number”: “9434636105522280669452”
}
}
}
As expected, because the order is already closed, the response is shown below:
{“errors”:[“Fulfillment order 7193725174040 has an unfulfillable status= closed.”]}
Hi Cwtart,
I’m having issues with that mutation fulfillmentCreate. Which mutation are you using? Because fulfillmentCreate is returning this error.
Error: Field ‘lineItemsByFulfillmentOrder’ doesn’t exist on type ‘Fulfillment’.
Thanks!
MrGiga
4
Same question here - additionally, I am new in GraphQL.
This is my call:
“query”: “mutation FulfillmentCreate($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
lineItemsByFulfillmentOrder { fulfillmentOrderId fulfillmentOrderLineItems { id quantity } }
trackingInfo { company number url }
}
}
}”,
“variables”: {
“fulfillment”: {
“lineItemsByFulfillmentOrder”: [
{
“fulfillmentOrderId”: “gid://shopify/Order/123”,
“fulfillmentOrderLineItems”: [
{
“id”: “gid://shopify/LineItem/123111”,
“quantity”: 1
},
{
“id”: “gid://shopify/LineItem/123222”,
“quantity”: 1
},
{
“id”: “gid://shopify/LineItem/123333”,
“quantity”: 4
},
{
“id”: “gid://shopify/LineItem/123444”,
“quantity”: 1
}
]
}
],
“notifyCustomer”: true,
“trackingInfo”: {
“company”: “DHL”,
“number”: “xxxx”,
“url”: “https://www.dhl.de/de/privatkunden/dhl-sendungsverfolgung.html?piececode=xxx”
}
}
}
Result is:
{
“errors”: [
{
“message”: “Field ‘lineItemsByFulfillmentOrder’ doesn’t exist on type ‘Fulfillment’”,
“locations”: [
{
“line”: 1,
“column”: 125
}
],
“path”: [
“mutation FulfillmentCreate”,
“fulfillmentCreate”,
“fulfillment”,
“lineItemsByFulfillmentOrder”
],
“extensions”: {
“code”: “undefinedField”,
“typeName”: “Fulfillment”,
“fieldName”: “lineItemsByFulfillmentOrder”
}
}
]
}
I don’t understand why the error refers to the type ‘Fulfillment’—I would expect it to be validated against ‘FulfillmentInput’
Was trying to post is it close?
If you haven’t solved it yet, this might help:
You need to retrieve the fulfillment ID first.
Once you have the ID, you can then proceed to create the fulfillment.