packages/core/src/workflows/product. Import them from @mercurjs/core/workflows and run them with the Medusa container. For plain updates and deletes of products, variants, and categories, use Medusa’s core flows, such as updateProductsWorkflow.
createProductsWorkflow
Creates master products with attributes and variants, links stores to them, and records each submission. Workflow idmercur-create-products. Returns the created ProductDTO[] in input order.
The workflow runs these steps in order:
- Runs the
validatehook withinputandproducts - Creates the products with Medusa’s
createProductsWorkflow, each with an internal__default__option - Attaches
attributeswithaddProductAttributesToProductWorkflow - Removes the
__default__option from products that gained a variant axis - Creates
variantswithcreateProductVariantsWorkflow, defaultingmanage_inventorytofalse - Links
seller_idswithassociateSellersWithProductStep - Records a
PRODUCT_ADDchange per product withrecordProductAuditChangeWorkflow - Runs the
productsCreatedhook withproductsandadditional_data - Emits
product.created
validate and productsCreated hooks. It emits product.created with { id } for each product.
confirmProductsWorkflow
Publishesproposed products. Workflow id mercur-confirm-products.
Records a
STATUS_CHANGE action with { status: "published" } per product, then sets the status.
It exposes the productsConfirmed hook with product_ids, internal_note, and additional_data. It emits product.published with { id, internal_note } for each product.
rejectProductWorkflow
Rejects oneproposed product. Workflow id mercur-reject-product.
Records a
STATUS_CHANGE action with { status: "rejected" }, then sets the status.
It exposes the productRejected hook with product_id, message, and additional_data. It emits product.rejected with { id, message }.
requestProductChangeWorkflow
Asks the submitter to revise aproposed product without changing its status. Workflow id mercur-request-product-change.
Records a
CHANGE_REQUESTED action with { message }.
It exposes the productChangeRequested hook with product_id, message, and additional_data. It emits product.change-requested with { id, message, actor_id }.
linkSellersToProductWorkflow
Adds stores to and removes stores from a product’s allowlist. Workflow idmercur-link-sellers-to-product.
Runs
associateSellersWithProductStep and detachSellersFromProductStep, which undo their changes if the run fails. No hooks or events.
linkSellersToProductCategoryWorkflow
Adds and removescategory_seller rows for a category. Workflow id mercur-link-sellers-to-product-category.
Runs
associateSellersWithProductCategoryStep and detachSellersFromProductCategoryStep. No hooks or events.
assignProductsToCategoryWorkflow
Moves products into one category. Workflow idmercur-assign-products-to-category.
Runs Medusa’s
updateProductsWorkflow with category_ids, so Medusa’s product update events fire. No hooks of its own.