createPromotionsStep - Medusa Core Workflows Reference

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

This step creates one or more promotions.

Example#

Code
1const data = createPromotionsStep([2  {3    code: "10OFF",4    type: "standard",5    application_method: {6      type: "percentage",7      value: 10,8      target_type: "items"9    }10  }11])

Input#

CreatePromotionDTO[]CreatePromotionDTO[]
codestring
The code of the promotion.
The type of the promotion:
  • standard indicates that a promotion is a standard one applied with conditions.
  • buyget indicates that a promotion is a "Buy X get Y" promotion.
The status of the promotion:
  • draft indicates that a promotion is currently being prepared
  • active indicates that a promotion is active
  • inactive indicates that a promotion is no longer active
application_methodCreateApplicationMethodDTO
The associated application method.
is_automaticbooleanOptional
Whether the promotion is applied automatically.
rulesCreatePromotionRuleDTO[]Optional
The rules of the promotion.
campaignCreateCampaignDTOOptional
The associated campaign.
campaign_idstringOptional
The associated campaign's ID.

Output#

PromotionDTO[]PromotionDTO[]
idstring
The ID of the promotion.
codestringOptional
The code of the promotion.
The type of the promotion:
  • standard indicates that a promotion is a standard one applied with conditions.
  • buyget indicates that a promotion is a "Buy X get Y" promotion.
statusPromotionStatusValuesOptional
The status of the promotion:
  • active promotion is available for user to consume
  • inactive promotion is no longer available to the user
  • draft promotion is currently being prepared
is_automaticbooleanOptional
Whether the promotion is applied automatically.
application_methodApplicationMethodDTOOptional
The associated application method.
rulesPromotionRuleDTO[]Optional
The rules of the promotion.
campaign_idnull | stringOptional
The associated campaign.
campaignCampaignDTOOptional
The associated campaign.
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