# fulfillmentOrderClose - admin-graphql - MUTATION Version: 2024-10 ## Description Marks an in-progress fulfillment order as incomplete, indicating the fulfillment service is unable to ship any remaining items, and closes the fulfillment request. This mutation can only be called for fulfillment orders that meet the following criteria: - Assigned to a fulfillment service location, - The fulfillment request has been accepted, - The fulfillment order status is `IN_PROGRESS`. This mutation can only be called by the fulfillment service app that accepted the fulfillment request. Calling this mutation returns the control of the fulfillment order to the merchant, allowing them to move the fulfillment order line items to another location and fulfill from there, remove and refund the line items, or to request fulfillment from the same fulfillment service again. Closing a fulfillment order is explained in [the fulfillment service guide](https://shopify.dev/apps/build/orders-fulfillment/fulfillment-service-apps/build-for-fulfillment-services#step-7-optional-close-a-fulfillment-order). ### Access Scopes `write_assigned_fulfillment_orders` access scope. Also: The user must have fulfill_and_ship_orders permission. ## Arguments * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - The ID of the fulfillment order to mark as incomplete. * [message](/docs/api/admin-graphql/2024-10/scalars/String): String - An optional reason for marking the fulfillment order as incomplete. ## Returns * [fulfillmentOrder](/docs/api/admin-graphql/2024-10/objects/FulfillmentOrder): FulfillmentOrder The fulfillment order that was marked as incomplete. * [userErrors](/docs/api/admin-graphql/2024-10/objects/UserError): UserError! The list of errors that occurred from executing the mutation. ## Examples ### Marks a fulfillment order as incomplete Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation fulfillmentOrderClose($id: ID!, $message: String) { fulfillmentOrderClose(id: $id, message: $message) { fulfillmentOrder { id status requestStatus } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/FulfillmentOrder/1046000779\",\n \"message\": \"Out of Stock\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation fulfillmentOrderClose($id: ID!, $message: String) {\n fulfillmentOrderClose(id: $id, message: $message) {\n fulfillmentOrder {\n id\n status\n requestStatus\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/FulfillmentOrder/1046000779\",\n \"message\": \"Out of Stock\"\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation fulfillmentOrderClose($id: ID!, $message: String) {\n fulfillmentOrderClose(id: $id, message: $message) {\n fulfillmentOrder {\n id\n status\n requestStatus\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/FulfillmentOrder/1046000779\",\n \"message\": \"Out of Stock\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation fulfillmentOrderClose($id: ID!, $message: String) {\n fulfillmentOrderClose(id: $id, message: $message) {\n fulfillmentOrder {\n id\n status\n requestStatus\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/FulfillmentOrder/1046000779\",\n \"message\": \"Out of Stock\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation fulfillmentOrderClose($id: ID!, $message: String) {\n fulfillmentOrderClose(id: $id, message: $message) {\n fulfillmentOrder {\n id\n status\n requestStatus\n }\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/FulfillmentOrder/1046000779", "message": "Out of Stock" } #### Graphql Response { "data": { "fulfillmentOrderClose": { "fulfillmentOrder": { "id": "gid://shopify/FulfillmentOrder/1046000779", "status": "INCOMPLETE", "requestStatus": "CLOSED" }, "userErrors": [] } } }