Creating Rules

Master the 3-step rule wizard and all 8 rule types

Using the 3-Step Wizard

Cart Guard’s rule wizard walks you through creating rules without technical knowledge.

Step 1: Choose Rule Type

You’ll see 5 common templates:

1. BOGO (Buy One Get One)

Use when: Promotional bundles with discounts
Example: “Buy Coffee, get 20% off when you add a Mug”

2. Minimum Order Value

Use when: Enforce minimum purchase amount
Example: “Minimum $50 order for free shipping”

3. Wholesale Minimum Quantity

Use when: Require minimum quantities per product
Example: “Must order 10+ units (wholesale)”

4. Category Restriction

Use when: Block specific category combinations
Example: “Can’t ship Fragile + Heavy items together”

5. Product Bundle (Required Items)

Use when: Enforce accessory purchases
Example: “Laptop requires charger”

💡 Pro Tip: Start with templates! They include pre-configured settings and customer messages. You can customize later.


Step 2: Select Products

The wizard shows a searchable product picker:

Search Methods:

  • By Name: Type “Coffee” → Select “Premium Coffee Beans”
  • By SKU: Type “SKU-101” → Select matching product
  • By Category: Filter dropdown → “Beverages”

Trigger Products vs Required Products:

Trigger Products = What customer adds that starts the rule

Example: Customer adds "Laptop" (trigger) → Rule activates

Required Products = What customer must also add to checkout

Example: Rule requires "Charger" + "Mouse" (required products)

Multiple Products:

  • Click “+ Add Product” to add more
  • Drag to reorder (priority matters for bundles)
  • Click X to remove

Step 3: Configure Details

Rule Name (required)

Good: "BOGO: Coffee + Mug (20% off)"
Bad: "Rule 1" (not descriptive)

💡 Use descriptive names! You’ll see this in analytics and order notes.

Priority (optional, default = 10)

Range: 1-100 (higher = evaluated first)
Example: Safety rules = 90, Promotional rules = 20

Customer Message (required)

Good: "Add {product_name} to complete your bundle and save 20%!"
Bad: "Error: Missing product"

Message Variables:

  • {product_name} – Links to required product
  • {min_qty} – Minimum quantity required
  • {quantity} – Current cart quantity
  • {max_qty} – Maximum quantity allowed

Action When Rule Triggers:

1. Block Checkout (default)
– Disables checkout button
– Shows error message on cart page
– Customer must fix cart to proceed

2. Show Toast Notification
– Dismissible popup message
– Doesn’t block checkout (warning only)
– Good for suggestions

3. Redirect to URL
– Sends customer to custom page
– Example: “Orders over $10K → /enterprise-quote”
– Useful for special handling


Advanced Rule Options

Click “Show Advanced Options” to reveal:

Stock Validation

☑️ Check stock before allowing purchase

Mode:
○ Any - At least one required product in stock (lenient)
○ All - All required products must be in stock (strict)

When to use: Prevent selling bundles when components are out of stock

Example:

Bundle: Laptop + Charger + Mouse
Stock: Laptop (5 in stock), Charger (0 in stock), Mouse (3 in stock)

Mode = "Any" → Bundle allowed ✅ (Laptop and Mouse available)
Mode = "All" → Bundle blocked ❌ (Charger out of stock)

Learn more about Stock Validation →


Quantity Synchronization

☑️ Auto-sync child quantities with parent product

Options:
☑️ Lock child removal (can't remove without parent)
☑️ Lock child quantity input (read-only on cart page)

When to use: Bundle components that must match parent quantity

Example:

Customer cart:
- Laptop x3 (parent)
- Charger x3 (child, auto-synced)

Customer changes Laptop to 5 → Charger automatically updates to 5
Customer tries to remove Charger → Blocked (locked to parent)

Learn more about Quantity Sync →


Bundle Discounts

Discount Type:
○ Percentage (e.g., 15% off bundle)
○ Fixed Amount (e.g., $5 off bundle)
○ Free Shipping

Discount Value: [15.00]

When to use: Incentivize bundle purchases

Example:

Cart before discount:
- Coffee: $12.00
- Mug: $8.00
Subtotal: $20.00

15% bundle discount: -$3.00
Total: $17.00

Stacking: Multiple bundle discounts combine!

Bundle A discount: -$3.00
Bundle B discount: -$2.00
Total savings: -$5.00

Learn more about Bundle Discounts →


Testing Rules

Before Saving:

  1. Preview Rule – See JSON structure (advanced users)
  2. Check Product IDs – Verify correct products selected
  3. Test Message – Read customer message for clarity

After Saving:

  1. Rule appears in Rules list with green “Active” badge
  2. Test immediately – Don’t wait for customer issues!

Testing Checklist:

Test 1: Trigger Rule

☑️ Add trigger product to cart
☑️ Verify error message displays on cart page
☑️ Confirm checkout button disabled
☑️ Check message variables replaced (e.g., {product_name} → actual name)

Test 2: Satisfy Rule

☑️ Add required products to cart
☑️ Verify error message disappears
☑️ Confirm checkout button enabled
☑️ Check discount applied (if configured)

Test 3: Edge Cases

☑️ Remove required product → Error reappears
☑️ Change quantities → Sync works (if configured)
☑️ Guest checkout → Rule still enforces
☑️ Mobile browser → Message displays correctly

View Violation Logs:

  1. Go to Cart Guard → Analytics
  2. Click “Recent Violations”
  3. See your test attempts logged with cart data

Rule Types Explained

Product Bundle Rules

Required Bundle

Purpose: Enforce product combinations (accessories, related items, safety requirements)

Use Cases:
Accessory Enforcement: “Laptop requires charger”
Safety Compliance: “Power tool requires safety glasses”
Bundle Sales: “Buy shirt, must add matching pants”

Configuration:

Trigger Products: [Laptop #500]
Required Products: [Charger #501, Mouse #502]
Action: Block checkout
Message: "Laptop bundle includes Charger and Mouse. Please add to cart."

Customer Experience:

1. Customer adds Laptop → Rule activates
2. Cart shows: "⚠️ Laptop bundle incomplete"
3. Checkout button disabled (grayed out)
4. Customer adds Charger and Mouse → Checkout enabled ✅

BOGO (Buy One Get One)

Purpose: Promotional bundles with automatic discounts

Use Cases:
Cross-Sell: “Buy coffee, get 20% off mug”
Upsell: “Add premium version, save 15%”
Seasonal Promos: “Holiday bundle: Buy 2, save $10”

Configuration:

Trigger Products: [Coffee #101]
Required Products: [Mug #102]
Discount Type: Percentage
Discount Value: 20.0
Action: Block checkout (until bundle complete)
Message: "Add Mug to your Coffee and save 20% on bundle!"

Customer Experience:

Cart before:
- Coffee: $12.00

Customer adds Mug →

Cart after:
- Coffee: $12.00
- Mug: $8.00
- Bundle Discount (20%): -$4.00
Subtotal: $16.00 (saved $4.00!)

Quantity Rules

Minimum Quantity

Purpose: Enforce minimum order quantities per product

Use Cases:
Wholesale Minimums: “Must order 10+ units”
Bulk Pricing: “Buy 50+ for wholesale price”
Sample Prevention: “No single-unit orders (trial packs only)”

Configuration:

Target Products: [Widget #300]
Minimum Quantity: 10
Action: Block checkout
Message: "Wholesale orders require minimum {min_qty} units. You have {quantity}."

Customer Experience:

Customer adds 3 units →
❌ "Wholesale orders require minimum 10 units. You have 3."
Checkout blocked

Customer changes to 12 units →
✅ Error clears, checkout enabled

Maximum Quantity

Purpose: Limit maximum order quantities per product

Use Cases:
Fairness Enforcement: “Limit 2 per customer (high-demand item)”
Prevent Resellers: “Max 5 units (no bulk purchasing)”
Stock Protection: “Limit quantities during low inventory”

Configuration:

Target Products: [Limited Edition #400]
Maximum Quantity: 5
Action: Block checkout
Message: "Limited to {max_qty} per customer. You have {quantity}."

Exact Quantity (Multiples)

Purpose: Require quantities in specific increments

Use Cases:
Pre-Packaged Items: “Sold in packs of 6”
Wholesale Cases: “Must order in multiples of 12”
Manufacturing Constraints: “Bulk orders in multiples of 100”

Configuration:

Target Products: [Pre-packaged #500]
Must be Multiple Of: 6
Action: Block checkout
Message: "Product sold in packs of 6. Please adjust quantity to 6, 12, 18, etc."

Category & Product Restrictions

Category Restriction

Purpose: Block specific category combinations in same cart

Use Cases:
Shipping Safety: “Can’t ship Fragile + Heavy items together”
Temperature Conflicts: “Can’t ship Frozen + Ambient together”
Regulatory: “Can’t ship Alcohol + Tobacco together”

Configuration:

Restricted Categories: [Fragile, Heavy Equipment]
Action: Block checkout
Message: "Fragile items cannot be shipped with Heavy Equipment. Please place separate orders."

Customer Experience:

Cart contains:
- Glass Vase (Fragile category)
- Dumbbell Set (Heavy Equipment category)

Result:
❌ "Fragile items cannot be shipped with Heavy Equipment..."
Checkout blocked

Customer removes one category →
✅ Error clears

Product Exclusion

Purpose: Block specific product combinations in same cart

Use Cases:
Allergen Safety: “Can’t order Peanuts + Peanut-Free items”
Brand Separation: “Can’t mix Competitor Brand A + Brand B”
Incompatibility: “Product X conflicts with Product Y (technical)”

Configuration:

Product A: [Allergenic Item #600]
Conflicting Products: [Peanut-Free Item #601]
Action: Block checkout
Message: "Cannot order allergenic and peanut-free items in same shipment (cross-contamination risk)."

Cart Value Rules

Minimum Cart Total

Purpose: Enforce minimum order value

Use Cases:
Free Shipping Threshold: “Minimum $50 for free shipping”
Order Profitability: “Minimum $25 order (processing costs)”
Wholesale Minimums: “B2B orders require $500 minimum”

Configuration:

Minimum Cart Value: $50.00
Action: Block checkout
Message: "Minimum order is $50. Add $[remaining] more to checkout."

Maximum Cart Total

Purpose: Limit maximum order value

Use Cases:
Fraud Prevention: “Orders over $5K require phone verification”
Enterprise Sales: “Orders over $10K → Redirect to /quote-request”
Credit Limit: “Net-30 accounts limited to $2,500/order”

Configuration:

Maximum Cart Value: $10,000.00
Action: Redirect
Redirect URL: /enterprise-quote
Message: "Large orders require custom quote. Redirecting to sales team..."

Common Rule Examples

Example 1: Coffee Bundle with Discount

Rule Type: BOGO
Trigger: Coffee (SKU 101)
Required: Mug (SKU 102)
Discount: 20% off bundle
Message: "Add Mug to get 20% off your Coffee bundle!"

Example 2: Wholesale Minimum

Rule Type: Minimum Quantity
Product: Widget (SKU 300)
Minimum: 10 units
Message: "Wholesale orders require minimum 10 units. You have {quantity}."

Example 3: Shipping Restriction

Rule Type: Category Restriction
Categories: Fragile, Heavy
Message: "Fragile and Heavy items cannot ship together. Please place separate orders."

Example 4: Free Shipping Threshold

Rule Type: Minimum Cart Value
Minimum: $50.00
Message: "Add ${remaining} more for FREE SHIPPING!"
Action: Toast (suggestion, not block)

Next Steps

Now that you understand rule creation, explore advanced features:

Or learn how to manage orders:


Last Updated: November 14, 2025
Plugin Version: 1.0

← Back: Getting Started | Next: Advanced Features →