Skip to content

Magento Sales Rules and Coupons — Cart Price Rules and Coupon Codes

DodaTech Updated 2026-06-27 11 min read

In this tutorial, you'll learn how to create and manage Magento cart price rules, generate coupon codes, set conditions for promotions, and apply discounts like percentage off, fixed amount, buy one get one, and free shipping.

What You'll Learn

  • Creating cart price rules with conditions and actions
  • Understanding coupon types: no coupon, auto-generated, specific coupon
  • Generating coupon codes in bulk with parameters
  • Setting rule conditions for cart subtotal, items, categories, and customer groups
  • Configuring discount actions: percentage, fixed amount, buy X get Y, free shipping
  • Managing coupon usage limits per customer and per coupon
  • Applying multiple rules with priority and stop processing
  • Best practices for rule performance and cron-based indexing

Why It Matters

Promotions drive sales. A well-timed discount converts hesitant shoppers, clears seasonal inventory, and rewards loyal customers. But a poorly configured promotion can lose money, apply discounts incorrectly, or fail to apply at all. Understanding Magento's cart price rules gives you precise control over exactly who gets what discount and under what conditions.

Real-World Use

A clothing store runs multiple concurrent promotions: 20% off all jackets (category-based), free shipping on orders over $100, and a $10 off coupon sent to VIP customers. A VIP customer buys two jackets totaling $140. The cart price rules apply the 20% discount to the jackets, the free shipping because the total exceeds $100, and the $10 coupon for being a VIP. The system calculates the correct final price respecting all rules in priority order.

Learning Path

flowchart LR
  A["Orders & Invoices"] --> B["Sales Rules & Coupons
← You are here"]:::current B --> C["Customer Accounts"] C --> D["Customer Groups"] D --> E["Store Configuration"] classDef current fill:#38bdf8,color:#0f172a,stroke-width:2px

Cart Price Rules Overview

Cart price rules apply discounts at checkout based on conditions. Unlike catalog price rules (which change product prices in listings), cart rules work on the shopping cart contents.

Go to Marketing > Promotions > Cart Price Rules to create and manage rules.

Each rule consists of:

  • Rule Information — Name, status, dates, customer groups
  • Conditions — When the rule applies (cart contents, customer attributes)
  • Actions — What the rule does (discount type, amount, free shipping)
  • Coupon Codes — Optional codes that trigger the rule

Creating a Rule

To create a new cart price rule:

  1. Go to Marketing > Promotions > Cart Price Rules.
  2. Click Add New Rule.
  3. Fill in the Rule Information:
Rule Name: Winter Sale 20% Off
Description: 20% off all orders over $50
Status: Active
Customer Groups: General, Not Logged In
Coupon: No Coupon (applies automatically)
From: 2026-01-01
To: 2026-01-31
Priority: 1
Stop Further Processing: No

Conditions Section

Conditions determine when the rule applies. Click the green plus to add conditions.

Cart conditions:

If ALL of these conditions are TRUE:
  Cart Subtotal >= 50
  Total Items Quantity >= 1

Available cart conditions:

  • Cart Subtotal — Total before discounts
  • Total Items Quantity — Number of items in cart
  • Total Weight — Combined weight of all items
  • Shipping Method — Selected shipping method
  • Payment Method — Selected payment method (Adobe Commerce)

Product conditions:

If ALL of these conditions are TRUE:
  Category is 5 (Winter Clothing)
  AND SKU starts with WIN-

Available product conditions:

  • Category — Product belongs to specific category
  • SKU — Specific product or pattern
  • Product Attribute — Any product attribute (color, size, brand)
  • Attribute Set — Products in a specific attribute set

Combined conditions:

If ALL of these conditions are TRUE:
  Cart Subtotal >= 75
  AND Category is 8 (Accessories)
  AND Customer Group is VIP

This rule applies only when the cart subtotal is at least $75, at least one item is in the Accessories category, and the customer is in the VIP group.

Combining conditions:

You can use ALL (AND logic) or ANY (OR logic) for condition groups:

If ALL of these conditions are TRUE:
  Cart Subtotal >= 50
  If ANY of these conditions are TRUE:
    Category is 5
    Category is 8

This applies if subtotal is over $50 AND the cart contains items from either category 5 OR category 8.

Actions Section

Actions define the discount that is applied.

Apply options:

Apply Type Behavior Example
Percent of product price discount Discount by percentage 20% off
Fixed amount discount Fixed amount per item $10 off each item
Fixed amount discount for whole cart Fixed amount off total $20 off entire order
Buy X get Y free Free items Buy 2 get 1 free
Discount on shipping Reduce shipping cost 50% off shipping

Configuration per action type:

For Percent of product price discount:

Apply: Percent of product price discount
Discount Amount: 20
Maximum Qty Discount is Applied To: 0 (no limit)
Discount Qty Step (Buy X): 0
Apply to Shipping Amount: No
Discard subsequent rules: No (for priority stacking)
Free Shipping: No

For Buy X get Y free:

Apply: Buy X get Y free (discount amount is Y)
Discount Amount: 1 (get 1 free)
Discount Qty Step (Buy X): 2 (buy 2)
Maximum Qty Discount is Applied To: 10
Apply to Shipping Amount: No
Discard subsequent rules: No
Free Shipping: No

This means: buy 2 items, get 1 free (up to 10 free items total).

For Free Shipping:

Apply: Percent of product price discount
Discount Amount: 0
Free Shipping: For matching items only

You can also enable free shipping independently of discounts.

Coupon Types

Cart price rules can use three coupon modes:

No Coupon: The rule applies automatically to every qualifying cart. Use for site-wide sales that do not require a code.

Auto (Coupon Without Code): A coupon is automatically applied when the conditions are met. The customer does not need to enter a code. Useful for system-generated discounts.

Specific Coupon: The customer must enter a coupon code to trigger the rule. The code is generated by you or generated in bulk by Magento.

Coupon Generation

For specific coupons, you can generate multiple codes at once:

  1. Set Coupon to "Specific Coupon."
  2. Click Generate to open the generator.
  3. Configure:
Coupon Qty: 100
Code Length: 8
Code Prefix: SALE-
Code Suffix: -2026
Dash Every 3 Characters: 3
Code Format: Alphanumeric

Generated example codes:

SALE-A3B-2C1-2026
SALE-D4E-5F6-2026
SALE-G7H-8I9-2026

Each code is unique. You can export the list of generated codes for distribution via email campaigns.

Coupon Usage

Control how and when coupons are used:

Usage per coupon:

  • Uses per Coupon — Maximum times one code can be used (e.g., 100 uses per code)
  • Uses per Customer — How many times one customer can use the coupon
  • Uses per Customer Group — Restrict to specific groups

Coupon lifetime:

  • From — Date the coupon becomes active
  • To — Date the coupon expires

Cart Price Rule Examples

Here are complete examples of common promotions:

Example 1: 10% off orders over $50

Rule Information:
  Status: Active
  Coupon: No Coupon
Conditions:
  Cart Subtotal >= 50
Actions:
  Apply: Percent of product price discount
  Discount Amount: 10

Example 2: Free shipping on orders over $100

Rule Information:
  Status: Active
  Customer Groups: General, Not Logged In
  Coupon: No Coupon
Conditions:
  Cart Subtotal >= 100
Actions:
  Apply: Percent of product price discount
  Discount Amount: 0
  Free Shipping: For shipment with matching items

Example 3: Buy one get one 50% off in Electronics category

Rule Information:
  Status: Active
  Coupon: Specific Coupon (code: BOGO50)
Conditions:
  Category is 12 (Electronics)
Actions:
  Apply: Buy X get Y free (discount amount is Y)
  Discount Amount: 50 (percent off second item)
  Discount Qty Step (Buy X): 2

Example 4: $20 off for VIP customer group

Rule Information:
  Status: Active
  Customer Groups: VIP
  Coupon: Specific Coupon (code: VIP20)
Conditions:
  Cart Subtotal >= 100
Actions:
  Apply: Fixed amount discount for whole cart
  Discount Amount: 20
  Discard subsequent rules: Yes (prevent stacking)

Rule Performance

Cart price rules are applied in real time at checkout. Each rule adds processing time. Performance considerations:

  • Limit active rules — Too many active rules slow down checkout. Deactivate expired rules.
  • Use conditions efficiently — Simple conditions (category, subtotal) are faster than complex conditions (product attributes, custom options).
  • Priority and stop processing — Use priority and "Discard Subsequent Rules" to prevent unnecessary rule evaluation.
  • Cron cleanup — The salesrule_clean_coupons cron job removes expired coupons. Ensure cron is running.

Cart rules do not require reindexing (unlike catalog rules). They are evaluated on every checkout request.

Common Mistakes

  1. Not setting date ranges. A rule without a from/to date is active forever. Always set both dates even for permanent rules — periodic deactivation prevents unintended discounts.

  2. Creating conditions that are too broad. A rule with no conditions applies to every order. Combined with a fixed amount discount, this gives away money on every purchase. Always set specific conditions.

  3. Using the wrong discount type. "Fixed amount discount for whole cart" applies once. "Fixed amount discount" applies per item. Using the wrong one gives too much or too little discount.

  4. Not testing coupons before going live. Creating a coupon without testing it means you may discover the discount does not apply correctly when real customers try to use it. Always test with a test account and test product.

  5. Allowing unlimited usage on high-value coupons. A $100 off coupon with no usage limit can be used 1,000 times. Set reasonable usage limits per coupon and per customer.

Practice Questions

  1. What is the difference between a cart price rule and a catalog price rule? Answer: Cart price rules apply discounts at checkout based on cart conditions (subtotal, items, categories) and can require coupon codes. Catalog price rules apply discounts to product prices in listings and are indexed. Cart rules are real-time; catalog rules are indexed.

  2. What does the "Buy X get Y free" action do? Answer: The "Buy X get Y free" action gives a discount on Y items when the customer buys X items. For example, "Buy 2 get 1 free" means X=2 and Y=1. The discount can be a percentage off or free items. The step determines how many the customer must buy to qualify.

  3. How do you limit a coupon to one use per customer? Answer: In the cart price rule, set "Uses per Customer" to 1. This ensures each logged-in customer can use the coupon only once. For guest customers, usage is tracked by the coupon code and email address combination.

  4. Challenge: Create a comprehensive promotional calendar for a clothing store. Design five cart price rules: 1) 15% off entire purchase for new customers (one-time use), 2) Free shipping on orders over $75, 3) Buy one get one free on socks (category: Accessories), 4) 20% off for VIP customer group (code: VIP20), 5) $10 off orders over $50 for newsletter subscribers. For each rule, document the conditions, actions, coupon type, usage limits, and date ranges. Generate 50 coupon codes for rule #5 and export them.

FAQ

Can coupon codes have spaces or special characters?

Coupon codes can contain letters, numbers, and hyphens. Spaces and special characters like ! or @ are not recommended because they are hard to type. Magento's generated codes use alphanumeric characters with optional dashes.

Why is my cart price rule not applying?

Check: 1) The rule is active and within its date range, 2) The conditions are met (cart subtotal, category, customer group), 3) The correct coupon code was entered (if specific coupon is required), 4) The coupon has not exceeded usage limits, 5) No higher-priority rule has 'Discard subsequent rules' enabled.

Can I combine multiple coupon codes on one order?

No, Magento allows only one coupon code per order. The system applies the best matching rule for the entered code. However, you can have multiple rules that apply automatically (no coupon required) alongside one coupon-based rule per order.

How do I create a coupon for a specific customer?

Generate a unique coupon code per customer. Use 'Specific Coupon' type and either generate one code manually or use the bulk generator. Send the code to the customer via email. Set 'Uses per Customer' to 1 to prevent sharing.

Mini Project

Your task: Build a complete promotional system for a seasonal sale.

  1. Create five cart price rules:

    • Rule 1: 10% off orders over $100 (no coupon, all customers)
    • Rule 2: Free shipping on orders over $75 (no coupon, all customers)
    • Rule 3: Buy one get one 50% off on "Winter Collection" category (coupon: WINTER50)
    • Rule 4: $25 off for VIP customers over $150 (coupon: VIPWINTER)
    • Rule 5: 15% off for first-time customers (generated codes with prefix NEW-, 50 codes)
  2. Configure each rule with appropriate conditions, customer groups, and usage limits.

  3. Generate 50 coupon codes for Rule 5.

  4. Set priorities so VIP discount takes precedence over general discounts.

  5. Test each coupon with appropriate test accounts and cart contents.

  6. Verify the stacking behavior: can a customer get free shipping + the VIP discount?

  7. Deactivate expired rules after the sale period.

This exercise teaches you to manage real-world promotions in Magento.

What's Next

Now that you understand sales rules and coupons, continue with customer management:

Continue to Lesson 15: Customer Accounts — Registration, account dashboard, and address book.

Related lessons:

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro