Skip to main content
Mercur’s offer-aware replacement for Medusa’s cancel-order-fulfillment flow. Validates that the fulfillment exists, is not shipped, and not already canceled, then cancels it on the order and at the provider, re-creates or tops up reservations, and adjusts inventory back up — dividing line quantities by each offer’s required_quantity so bundle offers restock correctly. Triggered by POST /vendor/orders/:id/fulfillments/:fulfillment_id/cancel. Emits order.fulfillment_canceled.

Usage

import { cancelOrderFulfillmentWorkflow } from "@mercurjs/core/workflows"

await cancelOrderFulfillmentWorkflow(container).run({
  input: {
    order_id: "order_123",
    fulfillment_id: "ful_123",
  },
})

Input

order_id
string
required
The order the fulfillment belongs to; must not be canceled.
fulfillment_id
string
required
The fulfillment to cancel; shipped or already-canceled fulfillments throw.
no_notification
boolean
Suppress customer notification for the cancellation.
additional_data
object
Custom data passed through to the hooks.

Result

result
void
No return value.

Hooks

  • orderFulfillmentCanceled — runs after cancellation with { fulfillment, additional_data }.