Run before EVERY discount rule creation or update. Check both the new rule's discount AND the cumulative effect with existing active rules (stacking).
The default maximum discount percentage (discountMargin) is 25%.
Any discount rule that exceeds this cap should be flagged before creation:
"This discount ({pct}%) exceeds the default cap of 25%. Proceeding only because you explicitly requested it."
Respect the cap unless user input explicitly overrides it.
The default minimum margin percentage (minMarginPct) is 15%.
Never create a discount that would push the effective margin below 15% unless the user explicitly overrides this constraint.
If cost data is available, calculate:
effective_margin = (price - cost - discount_amount) / price × 100effective_margin < minMarginPct → block and explain the margin impact.| Discount value | Action |
|---|---|
| Discount > 50% | Warn — "This discount is {pct}% off. A $100 product would sell for ${100 - pct}. Are you sure?" |
| Discount = 100% | Block unless explicitly confirmed — "This makes the product free." |
| Discount > 100% | Block always — "A discount cannot exceed 100%." |
User input overrides ALL constraints — margin caps, discount caps, naming conventions, percentage limits.
How it works:
Example reasoning output:
"Creating a 50% discount as requested. Note: this overrides the default 25% discount cap. The effective margin on a product with 60% gross margin would drop to 10%, below the default 15% minimum margin threshold. Proceeding per explicit user instruction."
When creating a new discount, also check the cumulative effect with existing active rules:
"Combined with the existing '{existingRuleName}' ({existingPct}%), the total effective discount would be approximately {combinedPct}%. This exceeds the {cap}% cap / pushes margin below {minMarginPct}%."
| Scenario | Action |
|---|---|
| Discount ≤ 25% and margin ≥ 15% | Proceed |
| Discount > 25% but ≤ 50%, no user override | Warn, ask for confirmation |
| Discount > 25%, user explicitly requested | Proceed, document override |
| Discount > 50% | Warn with dollar example, ask for confirmation |
| Discount = 100% | Block unless explicitly confirmed |
| Discount > 100% | Block always |
| Combined stacking exceeds cap | Warn about cumulative effect |
| Margin drops below 15%, no user override | Block, explain margin impact |
| Margin drops below 15%, user override | Proceed, document override |