Discussing APIs and development related to customers, discounts, and order management.
Hello,
I'm trying to find a way to Cancel an order via API or GraphQL, can you give me an up-to-date solution that works?
Thanks
Solved! Go to the solution
This is an accepted solution.
Hi again Noptech,
You should be able to use the /cancel.json endpoint on the Order API to achieve this. There's an example of what that call would look like in our developer docs here.
Hope this helps,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi Noptech,
This would depend on the specific type of order you're looking to cancel. Would this be simply refunding an order that's been made, or cancelling a fulfilment order that's in a fulfilment process (or cancelling an order before it's completed checkout)?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is a cancellation of the order process (without refund).
I want to perform the "Cancel" function, as there is a dropdown button in the order itself.
And the order should remain crossed out.
This is an accepted solution.
Hi again Noptech,
You should be able to use the /cancel.json endpoint on the Order API to achieve this. There's an example of what that call would look like in our developer docs here.
Hope this helps,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Is is possible to cancel an order via the graphql api? Not finding it in the docs...
Hey Liam,
Even though this is marked as accepted answer, it doesn't really answer the question of the topic. So maybe you can clarify: Is there a way to use the GraphQL api to cancel an order or do you have to go the long way then and use orderEdit and the like to manually do all that?
Thanks so much for your answer
Theo
Hey @TheodorFreundHT , This is a great question. There is not currently a mutation to cancel an order through GraphQL. There is an orderClose mutation you can use, however that emulates the behaviour of archiving an order.
The order cancel option in REST is currently the only option via API. It does have conditions on how it would work that are indicated on the developer documents, but if the conditions are met, that's going to be the easiest way.
I've submitted feedback to our product teams that this functionality is requested in GraphQL. IF it's added, it will be noted in our API release notes.
Hope that helps.
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog