Skip to main content
Rejects a product awaiting review: validates the product is in proposed status, sets it to rejected, and records a confirmed STATUS_CHANGE audit action whose external_note carries the rejection message. Triggered by POST /admin/products/:id/reject. Emits product.rejected with { id, message }.

Usage

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

await rejectProductWorkflow(container).run({
  input: {
    product_id: "prod_01H...",
    message: "Images do not meet marketplace guidelines",
    actor_id: "user_01H...",
  },
})

Input

product_id
string
required
Id of the product to reject. Must currently be in proposed status.
message
string
Vendor-facing rejection reason, stored as the audit change’s external_note and included in the emitted event.
actor_id
string
Actor id recorded on the audit trail entry.

Result

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

Hooks

productRejected
hook
Runs after rejection with { product_id, message }.