EzyStudio ADF

Discount Values & Targets

Discount Values & Targets

Every rule group must define what discount to apply and where to apply it. This is handled through two complementary configurations: the discount value (how much to discount) and the target (what to discount). This page covers the schema, behavior, and configuration options for both.


Discount Value Types

The discount value defines the type and magnitude of the discount applied when a rule group’s conditions are met.

Schema

FieldTypeRequiredDescription
typestringYesThe discount calculation method
valuenumberYesThe discount amount or percentage
maxDiscountAmountnumberNoMaximum discount cap (in cart currency)
messagestringNoCustomer-facing discount message

Supported Types

TypeDescriptionValue Interpretation
percentagePercentage off the original pricevalue is the percentage (e.g., 10 = 10% off)
fixedAmountFixed monetary amount offvalue is the currency amount to subtract
fixedPriceSet a fixed price (reserved)value is the target price per unit

Mapping to Shopify Operations

Each discount value type maps to a specific Shopify discount operation:

Discount TypeShopify OperationBehavior
percentagePercentageReduces price by the given percentage
fixedAmountFixedAmountSubtracts a flat amount from the price
fixedPriceFixedAmount (calculated)Calculates the difference to reach the target price, then applies as a fixed amount

JSON Examples

Percentage discount:

{
  "type": "percentage",
  "value": 15,
  "message": "15% off your order"
}

Fixed amount discount with cap:

{
  "type": "fixedAmount",
  "value": 25,
  "maxDiscountAmount": 25,
  "message": "$25 off"
}

Percentage discount with maximum cap:

{
  "type": "percentage",
  "value": 20,
  "maxDiscountAmount": 50,
  "message": "20% off (up to $50)"
}

Fixed price (reserved):

{
  "type": "fixedPrice",
  "value": 9.99,
  "message": "Special price: $9.99"
}

Target Types

The target defines which items in the cart receive the discount. There are three target types corresponding to the three discount function categories: product, order, and shipping.


Product Target

Product targets apply discounts to individual cart line items. They provide fine-grained control over which products are discounted and how many units are affected.

Schema

FieldTypeRequiredDescription
scopestringYesDetermines which products are targeted
specificVariantIdsstring[]ConditionalRequired when scope is specific
excludedVariantIdsstring[]NoVariant GIDs to exclude from the discount
maxAffectedItemsnumberNoMaximum number of items to discount

Scope Behavior

ScopeDescription
allAll cart lines are eligible for the discount
filteredOnly lines that pass the rule group’s product-level conditions are eligible
specificOnly the explicitly listed variant IDs are eligible

JSON Examples

All products:

{
  "scope": "all"
}

Filtered by conditions:

{
  "scope": "filtered",
  "maxAffectedItems": 5
}

Specific variants with exclusions:

{
  "scope": "specific",
  "specificVariantIds": [
    "gid://shopify/ProductVariant/111111111",
    "gid://shopify/ProductVariant/222222222"
  ],
  "excludedVariantIds": [
    "gid://shopify/ProductVariant/333333333"
  ]
}

All products, limited quantity:

{
  "scope": "all",
  "maxAffectedItems": 3,
  "excludedVariantIds": [
    "gid://shopify/ProductVariant/999999999"
  ]
}

Order Target

Order targets apply discounts to the order subtotal rather than individual line items.

Schema

FieldTypeRequiredDescription
excludedVariantIdsstring[]NoVariant GIDs to exclude from the order subtotal calculation

The order target maps to the Shopify OrderSubtotal target. The discount is applied to the overall order rather than distributed across individual lines.

JSON Examples

Simple order discount:

{}

Order discount with exclusions:

{
  "excludedVariantIds": [
    "gid://shopify/ProductVariant/444444444",
    "gid://shopify/ProductVariant/555555555"
  ]
}

Shipping Target

Shipping targets apply discounts to delivery options. They provide extensive control over which shipping methods are discounted.

Schema

FieldTypeRequiredDescription
scopestringYesDetermines which shipping options are targeted
maxShippingPricenumberNoMaximum shipping price to discount (caps the discount)
shippingOptionNamesstring[]ConditionalRequired when scope is byName
shippingNameOperatorstringConditionalRequired when scope is byName

Shipping Scopes

ScopeDescription
allAll delivery options receive the discount
firstOnly the first delivery option
cheapestOnly the cheapest delivery option
mostExpensiveOnly the most expensive delivery option
byNameOnly delivery options matching the specified names
noneNo shipping discount (effectively disables shipping targeting)

Name Matching Operators

When using the byName scope, the shippingNameOperator field controls how shipping option names are matched:

OperatorDescription
equalsExact match against the shipping option name
containsSubstring match within the shipping option name
startsWithShipping option name must start with the given string
endsWithShipping option name must end with the given string

JSON Examples

Free shipping on all methods:

{
  "scope": "all"
}

Discount on cheapest option with cap:

{
  "scope": "cheapest",
  "maxShippingPrice": 10
}

Free shipping by name:

{
  "scope": "byName",
  "shippingOptionNames": ["Standard Shipping", "Economy"],
  "shippingNameOperator": "equals"
}

Discount on most expensive option:

{
  "scope": "mostExpensive",
  "maxShippingPrice": 15
}

Name matching with contains:

{
  "scope": "byName",
  "shippingOptionNames": ["Express"],
  "shippingNameOperator": "contains"
}