Key concepts
Promotions
A promotion defines the discount rules and constraints:- Type: The kind of discount (percentage, fixed amount, BOGO, bundle, tiered, free shipping, gift with purchase)
- Scope: What the promotion applies to (all products, specific products, categories, collections, or departures)
- Value: The discount amount or percentage
- Validity period: When the promotion is active
- Usage limits: Maximum total uses or per-customer limits
Promotion codes
Codes are the actual strings customers enter to redeem a promotion:- Each promotion can have multiple codes
- Codes can have their own validity periods and usage limits
- Codes are automatically uppercased for case-insensitive matching
Scopes required
Promotion types
Promotion scopes
Validation flow
When validating a promotion code:- Code lookup: Find the code and check it’s active
- Code validity: Check date range and usage limits
- Promotion status: Verify parent promotion is active
- Promotion validity: Check promotion date range and total usage
- Order constraints: Verify minimum order value, currency, product eligibility
- Customer limits: Check per-customer usage if customer ID provided
- Calculate discount: Return the applicable discount amount