Skip to main content
Mercur ships 7 catalog workflows in 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 id mercur-create-products. Returns the created ProductDTO[] in input order. The workflow runs these steps in order:
  1. Runs the validate hook with input and products
  2. Creates the products with Medusa’s createProductsWorkflow, each with an internal __default__ option
  3. Attaches attributes with addProductAttributesToProductWorkflow
  4. Removes the __default__ option from products that gained a variant axis
  5. Creates variants with createProductVariantsWorkflow, defaulting manage_inventory to false
  6. Links seller_ids with associateSellersWithProductStep
  7. Records a PRODUCT_ADD change per product with recordProductAuditChangeWorkflow
  8. Runs the productsCreated hook with products and additional_data
  9. Emits product.created
It exposes the validate and productsCreated hooks. It emits product.created with { id } for each product.

confirmProductsWorkflow

Publishes proposed 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 one proposed 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 a proposed 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 id mercur-link-sellers-to-product. Runs associateSellersWithProductStep and detachSellersFromProductStep, which undo their changes if the run fails. No hooks or events.

linkSellersToProductCategoryWorkflow

Adds and removes category_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 id mercur-assign-products-to-category. Runs Medusa’s updateProductsWorkflow with category_ids, so Medusa’s product update events fire. No hooks of its own.

Exported steps

These steps are exported for use in your own workflows: