Skip to main content
Declines a pending ProductChange: validates the change exists and is still pending, then sets it to declined with declined_by, declined_at, and declined_reason — the staged actions are never applied to the master product. Emits product-change.declined with { id }.

Usage

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

await rejectProductChangeWorkflow(container).run({
  input: {
    id: "prch_01H...",
    declined_by: "user_01H...",
    declined_reason: "Price change exceeds allowed range",
  },
})

Input

id
string
required
Id of the product change to decline. Must exist and be in pending status.
declined_by
string
Actor id recorded as the decliner on the change.
declined_reason
string
Vendor-facing reason stored on the change.
additional_data
object
Arbitrary data forwarded to the productChangeRejected hook.

Result

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

Hooks

validate
hook
Runs first with { input } — use it to block rejection.
productChangeRejected
hook
Runs after the decline with { id, additional_data }.