Workflows
acceptProductCategoryRequestWorkflow
This documentation provides a reference to theacceptProductCategoryRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a product category creation request by creating the category and updating the request status to “accepted”.
Source code
Examples
- API Route (via utility)
packages/modules/requests/src/api/admin/requests/[id]/route.ts
Steps
- createProductCategoriesWorkflow: Creates the product category using Medusa’s core workflow.
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
The created product category.
acceptProductCollectionRequestWorkflow
This documentation provides a reference to theacceptProductCollectionRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a product collection creation request by creating the collection and updating the request status to “accepted”.
Source code
Steps
- createCollectionsWorkflow: Creates the product collection using Medusa’s core workflow.
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
The created product collection.
acceptProductRequestWorkflow
This documentation provides a reference to theacceptProductRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a product creation request by setting the product status to “published” and updating the request status to “accepted”.
Source code
Steps
- updateProductStatusStep: Sets the product status to “published”.
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
The published product.
acceptProductTagRequestWorkflow
This documentation provides a reference to theacceptProductTagRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a product tag creation request by creating the tag and updating the request status to “accepted”.
Source code
Steps
- createProductTagsWorkflow: Creates the product tag using Medusa’s core workflow.
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
The created product tag.
acceptProductTypeRequestWorkflow
This documentation provides a reference to theacceptProductTypeRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a product type creation request by creating the type and updating the request status to “accepted”.
Source code
Steps
- createProductTypesWorkflow: Creates the product type using Medusa’s core workflow.
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
The created product type.
acceptReviewRemoveRequestWorkflow
This documentation provides a reference to theacceptReviewRemoveRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a review removal request by emitting an event to trigger review deletion and updating the request status to “accepted”.
Source code
Steps
- emitEventStep: Emits a review removal event.
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
Returns true after processing.
acceptSellerCreationRequestWorkflow
This documentation provides a reference to theacceptSellerCreationRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow accepts a seller creation request by updating the request status to “accepted”. The actual seller creation is handled separately.
Source code
Steps
- updateRequestWorkflow: Updates the request status to “accepted”.
Input
The request acceptance details.
Output
Returns an empty object.
createProductRequestWorkflow
This documentation provides a reference to thecreateProductRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow creates a product creation request, links it to the seller, and emits events for notification and tracking. It exposes a hook for custom extensions.
Source code
Examples
- Subscriber
packages/modules/requests/src/subscribers/product-request-to-create.ts
Steps
- createRequestStep: Creates the request record.
- createRemoteLinkStep: Links the request to the seller.
- emitMultipleEventsStep: Emits
requests.*.createdandproduct_request.createdevents.
Hooks
- productRequestCreated: Hook that fires after a product request is created, providing the
requestIdandsellerId.
Input
The product request creation details.
Output
Array containing the created request.
createProductUpdateRequestWorkflow
This documentation provides a reference to thecreateProductUpdateRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow creates a product update request by setting the product status to “proposed”, creating the request record, linking it to the seller, and emitting events. It exposes a hook for custom extensions.
Source code
Examples
- Subscriber
packages/modules/requests/src/subscribers/product-update-request-to-create.ts
Steps
- updateProductStatusStep: Sets the product status to “proposed”.
- createRequestStep: Creates the request record with type “product_update”.
- createRemoteLinkStep: Links the request to the seller.
- emitMultipleEventsStep: Emits
requests.*.createdandproduct_update_request.createdevents.
Hooks
- productUpdateRequestCreated: Hook that fires after a product update request is created, providing the
requestIdandsellerId.
Input
The product update request creation details.
Output
Array containing the created request.
createRequestWorkflow
This documentation provides a reference to thecreateRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow creates a general request, links it to the seller, and emits a creation event. It exposes a hook for custom extensions.
Source code
Examples
- API Route
packages/modules/requests/src/api/vendor/requests/route.ts
Steps
- createRequestStep: Creates the request record.
- createRemoteLinkStep: Links the request to the seller.
- emitEventStep: Emits a
requests.*.createdevent.
Hooks
- requestCreated: Hook that fires after a request is created, providing the
requestIdandsellerId.
Input
The request creation details.
Output
Array containing the created request.
createSellerCreationRequestWorkflow
This documentation provides a reference to thecreateSellerCreationRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow creates a seller registration request and emits events for notification and tracking. It exposes a hook for custom extensions.
Source code
Examples
- Subscriber
packages/modules/requests/src/subscribers/seller-creation-request-to-create.ts
Steps
- createRequestStep: Creates the request record.
- emitMultipleEventsStep: Emits
seller_request.createdandrequests.*.createdevents.
Hooks
- sellerCreationRequestCreated: Hook that fires after a seller creation request is created, providing the
requestId.
Input
The seller creation request data.
Output
Array containing the created request.
importSellerProductsRequestWorkflow
This documentation provides a reference to theimportSellerProductsRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow creates multiple product requests from a CSV import. It creates request records for each product, links them to the seller, and emits events for each created request.
Source code
Examples
- Subscriber
packages/modules/requests/src/subscribers/import-seller-products-to-create.ts
Steps
- createRequestStep: Creates multiple request records.
- createRemoteLinkStep: Links each request to the seller.
- emitMultipleEventsStep: Emits
product_request.createdevents for each request.
Input
The bulk product request creation details.
Output
Array of created requests.
updateRequestDataWorkflow
This documentation provides a reference to theupdateRequestDataWorkflow. It belongs to the @mercurjs/requests package.
This workflow updates the data field of a pending or draft request. It’s used to modify request details before they’re reviewed.
Source code
Steps
- updateRequestDataStep: Updates the request data after validation.
Input
The request data update details.
Output
The updated request.
updateRequestWorkflow
This documentation provides a reference to theupdateRequestWorkflow. It belongs to the @mercurjs/requests package.
This workflow updates a request’s status and reviewer information, updates related product status if rejected, and emits a status-specific event. It exposes a hook for custom extensions.
Source code
Examples
- API Route
packages/modules/requests/src/api/admin/requests/[id]/route.ts
Steps
- updateRequestStep: Updates the request record.
- updateRelatedProductStatusStep: Updates product status to “rejected” if applicable.
- emitEventStep: Emits a dynamic event based on request type and status (e.g.,
requests.product.accepted).
Hooks
- requestUpdated: Hook that fires after a request is updated, providing the request
id.
Input
The request update details.
Output
The updated request.
Steps
createRequestStep
Creates one or more request records in the database. Accepts either a single request or an array of requests. Source codeInput
The request(s) to create.
Output
Array of created requests.
updateRelatedProductStatusStep
Updates the status of a product related to a request. Specifically handles product and product_update request types that have been rejected by setting the product status to “rejected”. Source codeInput
The ID of the request to check and process.
Output
This step does not return a value.updateRequestDataStep
Updates the data field of a request. Validates that the request is in “pending” or “draft” status and that the request type matches before merging the new data with existing data. Source codeInput
The request data update details.
Output
The updated request. Throws an
INVALID_DATA error if:- Request is not in “pending” or “draft” status
- Request type doesn’t match
updateRequestStep
Updates a request record in the database with new status and reviewer information. Source codeInput
The request update details.
Output
The updated request.