EzyStudio ADF

Rejection Rules

Rejection Rules

Rejection rules provide a mechanism to block entered discount codes when specific conditions are met. They act as gatekeepers that prevent incompatible or unauthorized discount codes from being applied, regardless of the discount’s own eligibility logic.


What Are Rejection Rules?

Rejection rules are a separate rule system that runs alongside your discount configuration. When a customer enters a discount code at checkout, rejection rules evaluate the cart state and — if their conditions are met — reject the entered code with a custom message.

Key characteristics:

  • Rejection rules run regardless of discount classes. They can reject codes from any discount, not just the one associated with your function.
  • They operate only on the cart.lines target (not delivery options).
  • They evaluate independently from your main discount rule groups.

Schema

Rejection rules are defined in a rejectionRules array at the top level of your configuration, alongside your main rule groups.

{
  "rejectionRules": [
    {
      "id": "rej_001",
      "name": "Block codes for guests",
      "enabled": true,
      "conditionLogic": "and",
      "conditions": [
        { "type": "customerIsAuthenticated", "boolValue": false }
      ],
      "message": "This discount code requires a customer account."
    }
  ]
}

Fields

FieldTypeRequiredDescription
idstringYesUnique identifier for the rejection rule
namestringYesHuman-readable name
enabledbooleanYesWhether this rejection rule is active
conditionLogicstringYesHow conditions combine: "and" or "or"
conditionsarrayYesArray of condition objects (same types as rule groups)
messagestringYesCustomer-facing rejection message

How They Work

The rejection rule evaluation follows a specific sequence:

  1. Collect rejectable entered discount codes. The function identifies all discount codes that have been entered by the customer and are eligible for rejection.

  2. If no rejectable codes exist, skip. Rejection rules are only relevant when there are entered discount codes to evaluate. If the cart has no entered codes, all rejection rules are bypassed entirely.

  3. For each enabled rejection rule: Evaluate the conditions against the current cart state. If the conditions are met, reject ALL rejectable discount codes with the rule’s message.

Cart has entered codes?
  No  → Skip all rejection rules
  Yes → For each enabled rejection rule:
           Evaluate conditions
           If conditions met → Reject ALL codes with message

Key Behaviors

All-or-Nothing Rejection

Rejection rules reject ALL rejectable discount codes, not individual ones. When a rejection rule’s conditions are met, every entered discount code is rejected. There is no mechanism to selectively reject specific codes while allowing others.

Empty Conditions Always Reject

A rejection rule with an empty conditions array will always reject entered discount codes (when codes are present). Since there are no conditions to fail, the rule unconditionally triggers.

{
  "id": "rej_block_all",
  "name": "Block all discount codes",
  "enabled": true,
  "conditionLogic": "and",
  "conditions": [],
  "message": "Discount codes are not accepted for this promotion."
}

Available in All 4 Functions

Rejection rules are supported in all four function types (Conditional, Tiered, BXGY, Bundle). However, the set of conditions available within rejection rules varies by function type — see the Condition Support section below.


Use Cases

1. Block Codes for Guest Customers

Require customers to log in before using discount codes.

{
  "id": "rej_guest",
  "name": "Require authentication for codes",
  "enabled": true,
  "conditionLogic": "and",
  "conditions": [
    { "type": "customerIsAuthenticated", "boolValue": false }
  ],
  "message": "Please log in to your account to use this discount code."
}

2. Block Codes for Low-Value Carts

Prevent discount codes on carts below a minimum spend threshold.

{
  "id": "rej_low_value",
  "name": "Minimum spend for codes",
  "enabled": true,
  "conditionLogic": "and",
  "conditions": [
    { "type": "cartSubtotal", "operator": "lessThan", "value": 50 }
  ],
  "message": "Discount codes require a minimum cart value of $50."
}

3. Block Codes in Specific Markets

Restrict discount code usage to certain regions.

{
  "id": "rej_market",
  "name": "Block codes outside North America",
  "enabled": true,
  "conditionLogic": "and",
  "conditions": [
    { "type": "market", "operator": "isNone", "countryCodes": ["US", "CA", "MX"] }
  ],
  "message": "This discount code is only valid in the United States, Canada, and Mexico."
}

4. Block All Discount Codes Unconditionally

Prevent any discount codes from being applied, regardless of conditions. This can be useful during certain promotions where automatic discounts should not be combined with manual codes.

{
  "id": "rej_unconditional",
  "name": "No codes during flash sale",
  "enabled": true,
  "conditionLogic": "and",
  "conditions": [],
  "message": "Discount codes cannot be combined with this promotion."
}

Condition Support

The conditions available within rejection rules vary by function type. Not all condition types are supported in every function.

FunctionCart-Level ConditionsProduct-Level Conditions
ConditionalFull set (all 9 types)Yes — rule fires if any cart line matches the product-level condition
TieredReduced set (customerTag, cartSubtotal, cartTotalQuantity, market)No
BXGYReduced set (customerTag, cartSubtotal, cartTotalQuantity, market)No
BundleReduced set (customerTag, cartSubtotal, cartTotalQuantity, market)No

Product-Level Conditions in Rejection Rules

When product-level conditions are used in rejection rules (Conditional function only), their behavior is slightly different from regular rule groups:

  • The rejection rule fires if any cart line matches the product-level condition.
  • This is a “has any matching line” check rather than a per-line filter.
  • For example, a rejection rule with a productTag condition of hasAny: ["gift-card"] would reject codes if the cart contains any gift card line item.
{
  "id": "rej_gift_cards",
  "name": "No codes with gift cards",
  "enabled": true,
  "conditionLogic": "and",
  "conditions": [
    { "type": "productTag", "operator": "hasAny", "tags": ["gift-card"] }
  ],
  "message": "Discount codes cannot be applied to orders containing gift cards."
}