Product-Level Conditions
Product-level conditions are evaluated per cart line. Unlike cart-level conditions that determine whether a rule group fires, product-level conditions filter which individual lines are eligible for the discount. A line that fails a product-level condition is simply excluded from the discount. It does not cause the entire rule group to fail.
This distinction is critical: product-level conditions control which items receive the discount, not whether the discount activates.
productTag
Check whether a product in a cart line has specific tags.
Operators: hasAny, hasNone
Fields:
| Field | Type | Description |
|---|---|---|
tags | string[] | List of product tags to check against |
Supported Functions: Conditional, Tiered
Product tags are resolved via the cart query variable at runtime. The comparison is case-insensitive.
hasAny: the line is eligible if the product has at least one of the specified tags.hasNone: the line is eligible if the product has none of the specified tags.
{
"type": "productTag",
"operator": "hasAny",
"tags": ["sale", "clearance"]
}
{
"type": "productTag",
"operator": "hasNone",
"tags": ["gift-card", "non-discountable"]
}
collection
Check whether a product belongs to specific collections.
Operators: inAny, inAll, inNone
Fields:
| Field | Type | Description |
|---|---|---|
collectionIds | string[] | List of Shopify collection GIDs |
Supported Functions: Conditional, Tiered
Collection IDs must be provided as Shopify Global IDs (GIDs) in the format gid://shopify/Collection/{id}. These are resolved via the cart query variable.
| Operator | Behavior |
|---|---|
inAny | The line is eligible if the product belongs to at least one of the specified collections. |
inAll | The line is eligible if the product belongs to all of the specified collections. |
inNone | The line is eligible if the product belongs to none of the specified collections. |
{
"type": "collection",
"operator": "inAny",
"collectionIds": [
"gid://shopify/Collection/123456789",
"gid://shopify/Collection/987654321"
]
}
{
"type": "collection",
"operator": "inAll",
"collectionIds": [
"gid://shopify/Collection/111111111",
"gid://shopify/Collection/222222222"
]
}
{
"type": "collection",
"operator": "inNone",
"collectionIds": [
"gid://shopify/Collection/999999999"
]
}
product
Check whether the cart line contains a specific product (all variants of that product are included).
Operators: isAny, isNone
Fields:
| Field | Type | Description |
|---|---|---|
productIds | string[] | List of Shopify product GIDs |
Supported Functions: Conditional, Tiered
Product IDs must be provided as Shopify Global IDs (GIDs) in the format gid://shopify/Product/{id}. This condition matches against the product itself: all variants of the specified products are included. Use productVariant instead if you need to target specific SKUs.
isAny: the line is eligible if the product matches any of the specified IDs.isNone: the line is eligible if the product matches none of the specified IDs.
{
"type": "product",
"operator": "isAny",
"productIds": [
"gid://shopify/Product/111111111",
"gid://shopify/Product/222222222"
]
}
{
"type": "product",
"operator": "isNone",
"productIds": [
"gid://shopify/Product/333333333"
]
}
productVariant
Check whether a specific product variant is in the cart line.
Operators: isAny, isNone
Fields:
| Field | Type | Description |
|---|---|---|
variantIds | string[] | List of Shopify product variant GIDs |
Supported Functions: Conditional, Tiered
Variant IDs must be provided as Shopify Global IDs (GIDs) in the format gid://shopify/ProductVariant/{id}. This condition enables discounts targeted at specific SKUs or variant options.
isAny: the line is eligible if the variant matches any of the specified IDs.isNone: the line is eligible if the variant matches none of the specified IDs.
{
"type": "productVariant",
"operator": "isAny",
"variantIds": [
"gid://shopify/ProductVariant/111111111",
"gid://shopify/ProductVariant/222222222"
]
}
{
"type": "productVariant",
"operator": "isNone",
"variantIds": [
"gid://shopify/ProductVariant/333333333"
]
}
lineProperty
Check custom line item properties (key-value pairs set on a cart line).
Operators: exists, notExists, equals, contains
Fields:
| Field | Type | Description |
|---|---|---|
key | string | The line property key to check |
values | string[] | Values to compare against (for equals and contains operators) |
Supported Functions: Conditional
Line properties are custom key-value pairs attached to individual cart line items, typically set by the storefront theme or third-party apps. They are commonly used for product customization (e.g., engraving text, custom sizing).
| Operator | Behavior |
|---|---|
exists | The line is eligible if the property key is present, regardless of value. |
notExists | The line is eligible if the property key is not present. |
equals | The line is eligible if the property value exactly matches one of the provided values. |
contains | The line is eligible if the property value contains one of the provided values as a substring. |
{
"type": "lineProperty",
"key": "subscription",
"operator": "equals",
"values": ["monthly", "annual"]
}
{
"type": "lineProperty",
"key": "_customization",
"operator": "exists"
}
{
"type": "lineProperty",
"key": "_gift_message",
"operator": "notExists"
}
lineQuantity
Check the quantity of a specific line item in the cart.
Operators: All numeric operators (greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, equals, between)
Fields:
| Field | Type | Description |
|---|---|---|
value | number | The threshold value for comparison |
valueTo | number | Upper bound (required only for between operator) |
Supported Functions: Conditional
This condition checks the quantity of an individual line item, not the total cart quantity. It is useful for per-item quantity thresholds such as “discount only applies when buying 3 or more of the same product.”
{
"type": "lineQuantity",
"operator": "greaterThanOrEqual",
"value": 3
}
{
"type": "lineQuantity",
"operator": "between",
"value": 2,
"valueTo": 10
}
linePrice
Check the per-unit price of a line item.
Operators: All numeric operators (greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual, equals, between)
Fields:
| Field | Type | Description |
|---|---|---|
value | number | The threshold value for comparison (in cart currency) |
valueTo | number | Upper bound (required only for between operator) |
Supported Functions: Conditional
This condition checks the per-unit price of the line item (not the line total). It is useful for excluding low-cost items from percentage discounts or targeting only premium-priced products.
{
"type": "linePrice",
"operator": "greaterThan",
"value": 50
}
{
"type": "linePrice",
"operator": "between",
"value": 25,
"valueTo": 100
}
{
"type": "linePrice",
"operator": "lessThan",
"value": 10
}