EzyStudio ADF

Core Concepts

This page covers the foundational concepts you need to understand when working with Advance Discount Function. These ideas apply across all four discount function types.

Discount Functions

Advance Discount Function provides 4 specialized WebAssembly functions, each designed to handle one discount pattern:

FunctionPurpose
ConditionalApply discounts when conditions are met
TieredScale discounts based on thresholds
Buy X Get YReward purchases of X with discounts on Y
BundleDiscount items when bought together as a set

Why Separate Functions?

Each discount function is an independent WebAssembly module rather than a single monolithic function. There are three reasons for this:

  1. Query complexity limit — Shopify imposes a 30-point complexity limit on the GraphQL input query each function can request. Splitting functionality across functions keeps each within budget.
  2. Isolation — A bug or misconfiguration in one function does not affect the others.
  3. Independent deployment — Each function can be updated and deployed on its own schedule.

Rule Groups

A rule group is the primary unit of configuration. It bundles together a set of conditions with a discount definition. Each discount function can contain multiple rule groups, letting you express several promotions within a single discount.

Every rule group includes:

  • Conditions — Boolean checks that determine whether the rule applies.
  • Discount value — The type and amount of the discount (percentage, fixed amount, etc.).
  • Targets — What the discount applies to (products, order, or shipping). For type-specific functions, this may be replaced by fields like tiers or bundleItems.

Conditions

Conditions are boolean checks evaluated against cart, customer, or product data. There are 18 condition types organized into two categories:

Cart-Level Conditions (9 types)

Cart-level conditions are evaluated once against the entire cart. If a cart-level condition fails when using AND logic, the entire rule group fails.

Examples include:

  • Cart subtotal thresholds
  • Cart item count
  • Customer tags
  • Customer order history
  • Discount code presence

Product-Level Conditions (8 types)

Product-level conditions are evaluated per cart line to filter which items are eligible for the discount.

Examples include:

  • Product type
  • Product tags
  • Product vendor
  • Collection membership
  • Price thresholds

Condition Logic (AND / OR)

The conditionLogic field controls how multiple conditions within a rule group are combined:

AND Logic

All conditions must pass for the rule group to apply. If any single condition fails, the entire rule group is skipped.

{
  "conditionLogic": "and",
  "conditions": [
    { "type": "cartSubtotal", "operator": "greaterThanOrEqual", "value": 100 },
    { "type": "customerTag", "operator": "contains", "value": "VIP" }
  ]
}

In this example, the discount only applies if the cart subtotal is $100+ and the customer has the “VIP” tag.

OR Logic

Any single condition is sufficient for the rule group to apply. There are special interaction rules when mixing cart-level and product-level conditions under OR logic — see the Rule Groups & Logic reference for details.

{
  "conditionLogic": "or",
  "conditions": [
    { "type": "cartSubtotal", "operator": "greaterThanOrEqual", "value": 200 },
    { "type": "customerTag", "operator": "contains", "value": "VIP" }
  ]
}

In this example, the discount applies if the cart subtotal is $200+ or the customer has the “VIP” tag.

Discount Classes

Discount classes define what the discount targets. There are three classes:

ClassDescription
ProductDiscounts applied to specific line items in the cart.
OrderA discount applied to the order subtotal.
ShippingA discount applied to delivery options.

Not every function type supports all three classes. Buy X Get Y and Bundle support Product and Shipping classes (but not Order). See the function type comparison in the Introduction for a full breakdown.

Discount Values

Each rule group specifies a discount value with one of three types:

TypeDescriptionExample
PercentageA percentage off the target price.20% off
Fixed AmountA fixed monetary amount off the target price.$10 off
Fixed PriceSet the price to a specific value. Reserved for future use in configuration.Set price to $25
{
  "discount": {
    "type": "percentage",
    "value": 20,
    "message": "20% off for VIP members"
  }
}

The message field is displayed to the customer at checkout alongside the discount.

Strategies

When a discount function contains multiple rule groups, the strategy controls how they interact:

First (Default)

The function evaluates rule groups in order and stops at the first match. Only the first qualifying rule group’s discount is applied.

{
  "strategy": "first",
  "ruleGroups": [ ... ]
}

Use this when your rule groups represent a priority order — for example, a higher-value discount for VIPs followed by a general discount for everyone else.

All

The function evaluates all rule groups and applies every matching discount. Multiple discounts can stack within the same function.

{
  "strategy": "all",
  "ruleGroups": [ ... ]
}

Use this when rule groups are independent and should combine — for example, a product category discount plus a loyalty reward.

Rejection Rules

Rejection rules let you block incompatible discount codes when certain conditions are met. Unlike regular rule groups, rejection rules:

  • Run regardless of discount classes — They are evaluated even if the discount function targets a different class.
  • Block, not apply — Instead of granting a discount, they prevent a discount code from being used.

This is useful for preventing customers from stacking a discount code on top of an automatic promotion.

Billing Tiers

Advance Discount Function offers three billing tiers. Each tier unlocks additional function types and features:

PlanPriceIncluded FunctionsKey Features
Starter$39/moConditional, Buy X Get Y18 conditions, AND/OR logic, all 3 discount classes, 10 rule groups
Pro$99/moConditional, Buy X Get Y, TieredEverything in Starter plus rejection rules, version history, AI (credit-based), 20 rule groups per discount
Enterprise$299/moAll 4 functionsEverything in Pro plus Bundle discounts, 25 rule groups per discount, priority support

The Starter plan includes a 7-day free trial. Feature gating is enforced at the function level — if your plan does not include a function type, it will not appear as an option when creating discounts.