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.Unique promotion identifier
Discount code (e.g., “SUMMER20”)
Type:
standard, buygetWhether promotion applies automatically (default: false)
ID of the associated campaign
How discount is applied
Targeting rules
ApplicationMethod
Defines how and where a promotion discount applies.Unique application method identifier
Method type:
fixed, percentageWhat to discount:
order, items, shipping_methodsDiscount value (amount for fixed, percentage for percentage)
Maximum items to discount
Number of items to apply discount to
Minimum quantity to buy (for buyget promotions)
How to allocate:
each, acrossPromotionRule
Defines targeting conditions for promotions.Unique rule identifier
ID of the promotion
Rule attribute (e.g., “customer_group_id”, “product_id”)
Comparison operator:
eq, ne, in, gt, gte, lt, lteRule values to match
Campaign
Groups promotions with budget management.Unique campaign identifier
Campaign name
Campaign description
Campaign currency code
Unique campaign identifier (e.g., “summer-2024”)
When campaign starts
When campaign ends
Campaign budget configuration
Promotions in this campaign
CampaignBudget
Tracks campaign budget and usage.Unique budget identifier
Budget type:
spend, usageBudget limit
Amount used so far
Service Interface
The Promotion Module service is available at@medusajs/medusa/promotion.
Create Promotion
Create a new promotion.Promotion data
Discount code (required for non-automatic promotions)
Promotion type:
standard, buygetWhether promotion applies automatically
How to apply the discount
Targeting rules
The created promotion(s)
Create Campaign
Create a promotional campaign with budget.Add Promotion to Campaign
Associate a promotion with a campaign.Compute Actions
Calculate promotion discounts for a cart or order.IDs of promotions to compute
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