FROM CACHE - en_header

Cannot figure out how to handle fulfillment cancellation requests

Shopify Partner
7 0 0

So shopify admin only allows me to request cancellation after I have accepted the fulfillment, and its status is "in_progress". 

When I receive the cancellation request in this state, and attempt to either accept the cancellation or deny it, I get an error that the fulfillment order is not in an open state. 

Is this a bug or am I missing something?

Replies 2 (2)
Shopify Staff
Shopify Staff
402 64 90

Hey @Brady-Agranoff 


I gathered this question was regarding the same order/fulfillment Order in our chat on the other thread 🙂


I note the latest state of your store's Order (3998428528682)  - the latest fulfillment Order ID for that in an open state, with a request_status of unsubmitted.


When you're calling your accept POST -/admin/api/2021-10/fulfillment_orders/{fulfillment_order_id}/fulfillment_request/accept.json - are you by chance passing the Correct fulfillment Order ID into that call? I say that as, this state of the fulfillment Order on this particular Order ID has changed a series of times and has resulted in a new fulfillment Order being generated.


Retrieving the fulfillment Order ID's assigned to the app for acceptance/cancellation would be possible by trying the GET detailed in the docs here.   Let me know if that helps - cheers!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Shopify Partner
7 0 0

Hi! Thanks so much for getting back to me. 


I wrote my initial post super poorly and I believe I didn't give enough details (as well as me having a bunch of test fulfillment orders still in my dev store) that ended up not giving a clear idea of my error.


An important note, our fulfillment app is intending to decline any cancellation request, as we don't accept them. The stores we are planning to work with are private partnerships and understand this, but we would still like to correctly display that a fulfillment cancellation request has been declined if they happen to make one anyway.


Flow of fulfillment order in our app:


1. Order is placed by a customer, and automatically a fulfillment request is sent to our app (this is what I believe you were mentioning when talking about about automicatic fulfillments in one of your replys? And I believe it just sends the fulfillment request automatically, no? If it isn't on, I need to go into orders and manually click a button to send the request to my app).


2. My app recognizes the fulfillment request, and makes a call to get the assigned fulfillment orders with the assignment status: fulfillment requested, and get the response of the order/orders as expected.


3. My app then validates the request according to the parameters we require, then either accepts or rejects the request (if we accept, we place the order into our system).


Up until here, the app works completely as expected. I can follow a given order on the orders page in the shopify admin, and see it in its different fulfillment status's properly. I can see when it is accepted/denied, and the messages. 


The error only comes when I attempt to make a cancellation request. I want to note, the shopify admin will not allow me to request fulfillment cancellation until the order has been accepted. Otherwise, the option just isn't there.


When I accept the fulfillment request, the fulfillment order status transitions from open to in_progress (expected per the documentation). However, when I then make a cancellation request, and attempt to accept it, it returns and error stating that the order is not in an open state.


I even tried making a call from the docs to transition the order into an open state, but received an error stating it was expecting the order to be in a "scheduled" state. I then tried to transition it from in_progress to scheduled, then to open. I continued to get errors here about the order being in unexpected states.


How/When do I deny these cancellation requests? I suspect I'm missing something obvious but I've been through the docs many times and seem to continue to miss it. 


I reran an order up until the cancellation requested so you can see the transition of the order. Note, my app attempted to decline the cancellation request, but was met with the error about the order not being in an open state. (Also note this was on a different development store than the last order)


OrderID: 4574603968738 (not fulfillment order id, just order ID)


error verbatim: {"errors":["The fulfillment order is not in an open state."]}


Thanks so much!