batchProductVariantsWorkflow - Medusa Core Workflows Reference
This documentation provides a reference to the batchProductVariantsWorkflow
. It belongs to the @medusajs/medusa/core-flows
package.
This workflow creates, updates, and deletes product variants. It's used by the Manage Variants in a Product Admin API Route.
You can use this workflow within your own customizations or custom workflows to manage the variants of a product. You can also use this within a seed script or in a custom import script.
Source CodeExamples#
Steps#
Workflow hook
Step conditioned by when
View step details
Input#
BatchProductVariantsWorkflowInput
BatchProductVariantsWorkflowInputThe product variants to manage.
BatchProductVariantsWorkflowInput
BatchProductVariantsWorkflowInputRecords to create in bulk.
Records to update in bulk.
delete
string[]OptionalRecords to delete in bulk.
delete
string[]OptionalOutput#
BatchProductVariantsWorkflowOutput
BatchProductVariantsWorkflowOutputThe result of managing the product variants.
BatchProductVariantsWorkflowOutput
BatchProductVariantsWorkflowOutputcreated
ProductVariantDTO[]The records that were created in the bulk operation.
created
ProductVariantDTO[]updated
ProductVariantDTO[]The records that were updated in the bulk operation.
updated
ProductVariantDTO[]deleted
string[]The IDs of the records deleted in the bulk operation.
deleted
string[]Emitted Events#
This section lists the events that are either triggered by the emitEventStep
in the workflow, or by another workflow executed within this workflow.
You can listen to these events in a subscriber, as explained in the Subscribers documentation.
Event | Description | Payload | Action |
---|---|---|---|
| Emitted when product variants are updated. |
| |
| Emitted when product variants are created. |
| |
| Emitted when product variants are deleted. |
|