Skip to main content
Confirms one or more pending ProductChange records: validates each change exists and is confirmable, marks them confirmed with confirmed_by, then runs the internal apply engine (applyProductChangeActionsWorkflow) to write the staged actions onto the master product. Triggered by POST /admin/product-changes/:id/confirm, and internally by autoConfirmProductChangeWorkflow. Emits product-change.confirmed with one { id } per change.

Usage

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

await confirmProductChangeWorkflow(container).run({
  input: {
    ids: ["prch_01H..."],
    confirmed_by: "user_01H...",
  },
})

Input

ids
string[]
required
Ids of the product changes to confirm. Each must exist and be in a confirmable (pending) state.
confirmed_by
string
Actor id recorded as the confirmer on each change.
internal_note
string
Operator-only note stored on each confirmed change.
external_note
string
Vendor-facing note stored on each confirmed change.
additional_data
object
Arbitrary data forwarded to the productChangeConfirmed hook.

Result

result
void
Returns nothing; the changes are confirmed and their actions applied in place.

Hooks

validate
hook
Runs first with { input } — use it to block confirmation of specific changes.
productChangeConfirmed
hook
Runs after actions are applied with { ids, additional_data }.