proposed, adds a CHANGE_REQUESTED entry to its history, and emits an event you can use to notify the seller.
Before you begin
You need the following in place:- A Mercur server with
@mercurjs/coreinstalled throughwithMercur() - A product with status
proposed. The workflow fails for any other status
Request and notify
Run the workflow from an admin route, then notify the seller from a subscriber.1
Run the workflow
requestProductChangeWorkflow checks the product status, records the audit change, and emits product.change-requested.src/api/admin/custom/products/[id]/revise/route.ts
details.message is null.2
Notify the seller
Subscribe to Replace the log line with your notification, for example a call to Medusa’s Notification module.
product.change-requested. The payload carries the product id, not a change id, plus the message and the operator’s id.src/subscribers/product-change-requested.ts
Where the request is stored
requestProductChangeWorkflow calls recordProductAuditChangeWorkflow, which stores the request as a change that starts out confirmed. The message is saved in two places:
details.message: on theCHANGE_REQUESTEDactionexternal_note: on the change, where the seller-facing note lives
product_change.created_by is the operator who asked.
Publish or reject instead
When the product is ready or can’t be fixed, resolve it with a product workflow instead. Both require the product to beproposed, and both record a confirmed STATUS_CHANGE audit change:
confirmProductsWorkflow: takesproduct_ids, sets them topublished, and emitsproduct.publishedrejectProductWorkflow: takesproduct_idand an optionalmessage, sets it torejected, and emitsproduct.rejected
Attach custom data with additional_data
requestProductChangeWorkflow passes additional_data to its productChangeRequested hook, along with product_id and message. Use it to store, for example, the checklist items the seller has to fix.