What is the flow of cancelling a specific order line?

I’m part of developing an intermediate application that connects our customers to Shopify. One of the flows is where our customers can cancel web orders in our ERP. Example:

  1. A customer orders something at Shopify
  2. The weborder gets synced to our ERP
  3. For some reason one of the lines has to be cancelled
  4. Our ERP will have to notify Shopify that the line should be cancelled

I have basically everything working except the very last step. I’m unsure what API calls to make or even what the functional flow should be.

Some suggestions I found:

  • cancel the order when all fulfillable items have been fulfilled (not an option for us)
  • create a refund for the specific lines

Going with the refundCreate for specific lines it just cancels the items with no open refund. When sending in a refund with an actual money amount I need to create a transaction, but I have no transaction. I found the suggestedRefund, but I’m not sure if that’s the way to go.

What I want to achieve is that our ERP can notify Shopify that a specific order line item has been cancelled and that a refund should be initiated. We don’t do anything with transactions on our side, it’s up to the shop owner to finish the cancellation.


For the Return variant we do: mutation returnCreate and then mutation closeReturn. I’m not exactly sure if this is the correct flow either. I did not develop this feature originally and I do not have experience with the functional flow of Shopify.

refundCreate - GraphQL Admin

Use this to cancel specific line

Yes I got there as well, but what about the transaction part of that call?

Been playing around with this call and it just makes it more confusing and complicated. Why can’t I just cancel an order line? If I try to make a SUGGESTED_REFUND I get “Kind suggested_refund is not a valid transaction”. If I use “REFUND” it automatically refunds which I don’t want.