Covers all questions related to inventory management, order fulfillment, and shipping.
Hello,
As process to migrate the cancel endpoint on the Fulfillment API due to its deprecation on version 2022-10, it is necessary to adapt requests made from Cancel Fulfillment to Cancel Fulfillment Order. However, it is not possible to Cancel a "Closed" Fulfillment Order using the FulfillmentOrder resource.
The following response is received:
Error 422 - "Fulfillment order is not in cancelable request state and can't be cancelled.".
Furthermore, it is possible to cancel the fulfillment manually by going to the order and cancelling the desired fulfillment.
So, since "Cancel" it is not one of supported actions for Fulfillment Order and Cancel Fulfillment is deprecated in version 2022-10, what should we do cancel an fulfillment successfully?
Thank you!
Solved! Go to the solution
This is an accepted solution.
Yes, only the "/orders/{order_id}/fulfillments/{fulfillment_id}/cancel.json" endpoint is deprecated. Use "/fulfillments/{fulfillment_id}/cancel.json" instead. 👍
To learn more visit the Shopify Help Center or the Community Blog.
[Update]
In 2020-10 release notes it is mentioned that the cancel fulfilment would be deprecated.
In Fulfilment page after checking the changes between 2022-04 and 2022-10, we can verify the the cancel request that the release notes might be referring is the one that goes through order id.
So, will the endpoint "/admin/api/2022-10/fulfillments/{fulfillment_id}/cancel.json" be deprecated?
I've run across this recently as well while trying to cancel fulfilments akin to what's available in the web UI. Glad to see I haven't gone crazy searching through the API!
For what it's worth, this seems to make it impossible to programmatically cancel a partially fulfiled order via the REST API. In my instance, I have an order with three fulfilment orders: one completed, and one more open and unfulfiled at either location. Until that completed fulfilment is cancelled, the order will complain with a 422: "Cannot cancel a paid and fulfilled order". The GraphQL API does not provide any relief either.
This is an accepted solution.
Yes, only the "/orders/{order_id}/fulfillments/{fulfillment_id}/cancel.json" endpoint is deprecated. Use "/fulfillments/{fulfillment_id}/cancel.json" instead. 👍
To learn more visit the Shopify Help Center or the Community Blog.
Ah, thanks for pointing that one out! I feel a bit dumb for not looking harder at the API docs.
I receive the same error via Graphql API
https://shopify.dev/docs/api/admin-graphql/2024-04/mutations/fulfillmentOrderCancel
mutation fulfillmentOrderCancel($id: ID!) {
fulfillmentOrderCancel(id: $id) {
fulfillmentOrder {
id
status
requestStatus
}
replacementFulfillmentOrder {
id
status
requestStatus
}
userErrors {
field
message
}
}
}
{
"id": "gid://shopify/FulfillmentOrder/6539764859058"
}
Response:
{
"data": {
"fulfillmentOrderCancel": {
"fulfillmentOrder": null,
"replacementFulfillmentOrder": null,
"userErrors": [
{
"field": null,
"message": "Fulfillment order is not in cancelable request state and can't be canceled."
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 2000,
"currentlyAvailable": 1990,
"restoreRate": 100
}
}
}
}
what can be wrong here?
Why are you trying to cancel a closed fulfillment order? Since no further action can occur on a closed fulfillment order, the cancel request fails by design. There is a state machine diagram in the documentation if that helps: https://shopify.dev/docs/apps/build/orders-fulfillment/fulfillment-service-apps#statuses
To learn more visit the Shopify Help Center or the Community Blog.