createProductsStep - Medusa Core Workflows Reference

This documentation provides a reference to the createProductsStep. It belongs to the @medusajs/medusa/core-flows package.

This step creates one or more products.

Example#

Code
1const data = createProductsStep([{2  title: "Shirt",3  options: [4    {5      title: "Size",6      values: ["S", "M", "L"]7    }8  ],9  variants: [10    {11      title: "Small Shirt",12      options: {13        Size: "S"14      }15    }16  ]17}])

Input#

CreateProductDTO[]CreateProductDTO[]
titlestring
The title of the product.
idstringOptional
Optionally pass an ID when creating a product.
subtitlestringOptional
The subttle of the product.
descriptionstringOptional
The description of the product.
is_giftcardbooleanOptional
Whether the product is a gift card.
discountablebooleanOptional
Whether the product can be discounted.
thumbnailstringOptional
The URL of the product's thumbnail.
handlestringOptional
The handle of the product. The handle can be used to create slug URL paths. If not supplied, the value of the handle attribute of the product is set to the slug version of the title attribute.
statusProductStatusOptional
The status of the product.
imagesUpsertProductImageDTO[]Optional
The associated images to created or updated.
external_idstringOptional
The id of the product in an external system
type_idstringOptional
The product type id to associate with the product.
collection_idstringOptional
The product collection to associate with the product.
tag_idsstring[]Optional
The tags to be associated with the product.
category_idsstring[]Optional
The product categories to associate with the product.
optionsCreateProductOptionDTO[]Optional
The product options to be created and associated with the product.
variantsCreateProductVariantDTO[]Optional
The product variants to be created and associated with the product.
widthnumberOptional
The width of the product.
heightnumberOptional
The height of the product.
lengthnumberOptional
The length of the product.
weightnumberOptional
The weight of the product.
origin_countrystringOptional
The origin country of the product.
hs_codestringOptional
The HS Code of the product.
materialstringOptional
The material of the product.
mid_codestringOptional
The MID Code of the product.
metadataMetadataTypeOptional
Holds custom data in key-value pairs.

Output#

ProductDTO[]ProductDTO[]
idstring
The ID of the product.
titlestring
The title of the product.
handlestring
The handle of the product. The handle can be used to create slug URL paths.
subtitlenull | string
The subttle of the product.
descriptionnull | string
The description of the product.
is_giftcardboolean
Whether the product is a gift card.
The status of the product.
thumbnailnull | string
The URL of the product's thumbnail.
widthnull | number
The width of the product.
weightnull | number
The weight of the product.
lengthnull | number
The length of the product.
heightnull | number
The height of the product.
origin_countrynull | string
The origin country of the product.
hs_codenull | string
The HS Code of the product.
mid_codenull | string
The MID Code of the product.
materialnull | string
The material of the product.
collectionnull | ProductCollectionDTO
The associated product collection.
collection_idnull | string
The associated product collection id.
typenull | ProductTypeDTO
The associated product type.
type_idnull | string
The associated product type id.
The associated product tags.
The associated product variants.
The associated product options.
The associated product images.
external_idnull | string
The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain a reference to the ID in the integrated service.
created_atstring | Date
When the product was created.
updated_atstring | Date
When the product was updated.
deleted_atstring | Date
When the product was deleted.
categoriesnull | ProductCategoryDTO[]Optional
The associated product categories.
discountablebooleanOptional
Whether the product can be discounted.
metadataMetadataTypeOptional
Holds custom data in key-value pairs.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break