Overview
The Promotion Module manages promotional campaigns, discount codes, and automated promotions. It provides rule-based promotion targeting and supports various discount types including percentage, fixed amount, and free shipping. Key Features:- Promotional campaigns with budgets
- Discount codes and automatic promotions
- Rule-based targeting (customer groups, products, etc.)
- Multiple application methods (order, item, shipping)
- Budget tracking and limits
- Time-based promotions
- Usage limits per customer
- Buy X Get Y promotions
When to Use
Use the Promotion Module when you need to:- Create discount codes for customers
- Run promotional campaigns
- Offer free shipping promotions
- Implement BOGO (Buy One Get One) offers
- Target specific customer groups
- Set promotion budgets and limits
- Schedule time-limited sales
- Track promotion usage
Data Models
Promotion
Represents a discount or promotional offer.string
required
Unique promotion identifier
string
Discount code (e.g., “SUMMER20”)
PromotionType
required
Type:
standard, buygetboolean
required
Whether promotion applies automatically (default: false)
string
ID of the associated campaign
ApplicationMethod
How discount is applied
PromotionRule[]
Targeting rules
ApplicationMethod
Defines how and where a promotion discount applies.string
required
Unique application method identifier
string
required
Method type:
fixed, percentagestring
required
What to discount:
order, items, shipping_methodsBigNumber
required
Discount value (amount for fixed, percentage for percentage)
number
Maximum items to discount
number
Number of items to apply discount to
number
Minimum quantity to buy (for buyget promotions)
string
How to allocate:
each, acrossPromotionRule
Defines targeting conditions for promotions.string
required
Unique rule identifier
string
required
ID of the promotion
string
required
Rule attribute (e.g., “customer_group_id”, “product_id”)
string
required
Comparison operator:
eq, ne, in, gt, gte, lt, ltePromotionRuleValue[]
required
Rule values to match
Campaign
Groups promotions with budget management.string
required
Unique campaign identifier
string
required
Campaign name
string
Campaign description
string
Campaign currency code
string
required
Unique campaign identifier (e.g., “summer-2024”)
DateTime
When campaign starts
DateTime
When campaign ends
CampaignBudget
Campaign budget configuration
Promotion[]
Promotions in this campaign
CampaignBudget
Tracks campaign budget and usage.string
required
Unique budget identifier
string
Budget type:
spend, usageBigNumber
Budget limit
BigNumber
Amount used so far
Service Interface
The Promotion Module service is available at@medusajs/medusa/promotion.
Create Promotion
Create a new promotion.CreatePromotionDTO | CreatePromotionDTO[]
required
PromotionDTO | PromotionDTO[]
The created promotion(s)
Create Campaign
Create a promotional campaign with budget.CreateCampaignDTO | CreateCampaignDTO[]
required
Add Promotion to Campaign
Associate a promotion with a campaign.Compute Actions
Calculate promotion discounts for a cart or order.string[]
required
IDs of promotions to compute
object
required
ComputeActionsResult
Computed discount actions
Register Usage
Track promotion usage.Revert Usage
Revert promotion usage (e.g., on order cancellation).Promotion Types
Standard Promotions
Basic discount promotions.Buy X Get Y (BOGO)
Automatic Promotions
Rule Examples
Customer Group Targeting
Product Targeting
Order Value Targeting
Integration Examples
With Cart Module
Apply promotions to cart.With Customer Module
Customer group promotions.Best Practices
- Code Uniqueness: Promotion codes must be unique. Use descriptive codes that are easy for customers to remember.
- Automatic vs Manual: Use automatic promotions for always-on offers (e.g., free shipping over $50). Use codes for targeted campaigns.
- Rule Combinations: Rules are AND conditions. All rules must match for a promotion to apply.
- Budget Tracking: Set campaign budgets to control promotion costs. Monitor usage regularly.
- Target Specificity: Use specific targeting rules to prevent unintended discount application.
- Testing: Always test promotions with sample carts before making them active.
-
Allocation:
each: Apply discount to each matching item individuallyacross: Apply total discount split across all matching items
Related Modules
- Cart Module - Apply promotions to carts
- Order Module - Track promotion usage
- Customer Module - Customer group targeting
- Product Module - Product targeting
- Pricing Module - Work with price lists