generateProductCsvStep - Medusa Core Workflows Reference

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

This step generates a CSV file that exports products. The CSV file is created and stored using the registered File Module Provider.

Example#

Code
1const { data: products } = useQueryGraphStep({2  entity: "product",3  fields: ["*", "variants.*", "collection.*", "categories.*"]4})5
6// @ts-ignore7const data = generateProductCsvStep(products)

Input#

GenerateProductCsvStepInputGenerateProductCsvStepInput
The products to export.
variantsnull | AdminProductVariant[]
The product's variants.
typenull | AdminProductType
The product's type.
optionsnull | AdminProductOption[]
The product's options.
imagesnull | AdminProductImage[]
The product's images.
idstring
The product's ID.
titlestring
The product's title.
handlestring
The product's handle.
subtitlenull | string
The product's subtitle.
descriptionnull | string
The product's description.
is_giftcardboolean
Whether the product is a gift card.
The product's status.
thumbnailnull | string
The product's thumbnail.
widthnull | number
The product's width.
weightnull | number
The product's weight.
lengthnull | number
The product's length.
heightnull | number
The product's height.
origin_countrynull | string
The product's origin country.
hs_codenull | string
The product's HS code.
mid_codenull | string
The product's MID code.
materialnull | string
The product's material.
collection_idnull | string
The ID of the associated product collection.
type_idnull | string
The ID of the associated product type.
discountableboolean
Whether the product is discountable.
external_idnull | string
The ID of the product in external systems.
created_atnull | string
The date the product was created.
updated_atnull | string
The date the product was update.
deleted_atnull | string
The date the product was deleted.
collectionnull | AdminCollectionOptional
The product's collection.
categoriesnull | AdminProductCategory[]Optional
The product's categories.
sales_channelsnull | AdminSalesChannel[]Optional
The sales channels that the product is available in.
tagsnull | AdminProductTag[]Optional
The product's tags.
metadatanull | Record<string, unknown>Optional
Key-value pairs of custom data.

Output#

GenerateProductCsvStepOutputGenerateProductCsvStepOutput
The export's details.
idstring
The ID of the generated file as returned by the File Module Provider.
filenamestring
The name of the generated file as returned by the File Module Provider.
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