groupProductsForBatchStep - Medusa Core Workflows Reference

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

This step groups products to be created or updated.

Example#

Code
1const data = groupProductsForBatchStep([2  {3    id: "prod_123",4    title: "Shirt",5    options: [6      {7        title: "Size",8        values: ["S", "M", "L"]9      }10    ]11  },12  {13    title: "Pants",14    options: [15      {16        title: "Color",17        values: ["Red", "Blue"]18      }19    ],20    variants: [21      {22        title: "Red Pants",23        options: {24          Color: "Red"25        },26        prices: [27          {28            amount: 10,29            currency_code: "usd"30          }31        ]32      }33    ]34  }35])

Input#

GroupProductsForBatchStepInputGroupProductsForBatchStepInput
The products to group.
titlestring
The product's title.
The product's options.
subtitlestringOptional
The product's subtitle.
descriptionstringOptional
The product's description.
is_giftcardbooleanOptional
Whether the product is a gift card.
discountablebooleanOptional
Whether discounts can be applied on the product.
imagesobject[]Optional
The product's images.
thumbnailstringOptional
The product's thumbnail URL.
handlestringOptional
The product's handle.
statusProductStatusOptional
The product's status.
type_idstringOptional
The ID of the product's type.
external_idstringOptional
The ID of the product in an external or third-party system.
collection_idstringOptional
The ID of the product's collection.
categoriesobject[]Optional
The product's categories.
tagsobject[]Optional
The product's tags.
variantsAdminCreateProductVariant[]Optional
The product's variants.
sales_channelsobject[]Optional
The sales channels that the product is available in.
weightnumberOptional
The product's weight.
lengthnumberOptional
The product's length.
heightnumberOptional
The product's height.
widthnumberOptional
The product's width.
hs_codestringOptional
The product's HS code.
mid_codestringOptional
The product's MID code.
origin_countrystringOptional
The product's origin country.
materialstringOptional
The product's material.
metadataRecord<string, unknown>Optional
Key-value pairs of custom data.
idstringOptional
The ID of the product to update.

Output#

GroupProductsForBatchStepOutputGroupProductsForBatchStepOutput
The products to create.
updateAdminUpdateProduct & object[]
The products to update.
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