Skip to main content
Cancels a pending ProductChange: validates the change exists and is still pending, then sets it to canceled with canceled_by and canceled_at — the staged actions are never applied to the master product. Triggered by POST /admin/product-changes/:id/cancel (operator) and POST /vendor/products/:id/cancel (vendor withdrawing their own edit). Emits product-change.canceled with { id }.

Usage

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

await cancelProductChangeWorkflow(container).run({
  input: {
    id: "prch_01H...",
    canceled_by: "sel_01H...",
  },
})

Input

id
string
required
Id of the product change to cancel. Must exist and be in pending status.
canceled_by
string
Actor id recorded as the canceler on the change.
additional_data
object
Arbitrary data forwarded to the productChangeCanceled hook.

Result

result
void
Returns nothing; the change status is updated in place.

Hooks

validate
hook
Runs first with { input } — use it to block cancellation.
productChangeCanceled
hook
Runs after cancellation with { id, additional_data }.