- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
cancelOrderWorkflow - Medusa Core Workflows Reference
This documentation provides a reference to the cancelOrderWorkflow
. It belongs to the @medusajs/medusa/core-flows
package.
This workflow cancels an order. An order can only be canceled if it doesn't have any fulfillments, or if all fulfillments are canceled. The workflow will also cancel any uncaptured payments, and refund any captured payments.
This workflow is used by the Cancel Order Admin API Route.
This workflow has a hook that allows you to perform custom actions on the canceled order. For example, you can make changes to custom models linked to the order.
You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around canceling an order.
Source CodeExamples#
Steps#
Workflow Hook
Step conditioned by when
Input#
CancelOrderWorkflowInput
CancelOrderWorkflowInput
CancelOrderWorkflowInput
CancelOrderWorkflowInputorder_id
stringThe ID of the order to cancel.
order_id
stringno_notification
booleanOptionalWhether to notify the customer of the cancelation.
no_notification
booleanOptionalcanceled_by
stringOptionalThe ID of the user that canceled the order.
canceled_by
stringOptionalHooks#
Hooks allow you to inject custom functionalities into the workflow. You'll receive data from the workflow, as well as additional data sent through an HTTP request.
Learn more about Hooks and Additional Data.
orderCanceled#
This hook is executed after the order is canceled. You can consume this hook to perform custom actions on the canceled order.
Example
Input
Handlers consuming this hook accept the following input.
input
objectThe input data for the hook.
input
objectorder
any
order
any