Skip to main content


Conditions define the criteria for triggering actions. In general, each condition is essentially a type:value pair. When all of the conditions associated with a rule are satisfied, Price Rules applies the rule’s actions to qualified items in the customer’s cart.


Conditions are optional, but an empty conditions array must be present within the rule for it to be valid. Empty conditions will always evaluate as true.

Condition properties

Price Rules actions support the following properties, depending on the condition type (see Condition property sets). An asterisk (*) indicates the property is required for all condition types.

type*string enumerationThe type of condition. For details, see Condition types.
valueinteger/stringThe value that the condition targets, for example, a customer ID.
operatorstring enumerationA comparison operator that defines a relation with the value. When the operator evaluates to true, the condition is satisfied.
namestringA custom name for the condition.
buy_quantityintegerThe number of items that must match the buy_product_selection to satisfy a BUY_X_GET_Y condition.
get_quantityintegerThe number of items eligible for a discount that a BUY_X_GET_Y condition is satisfied.
priorityintegerWhen there are multiple BUY_X_GET_Y conditions in the same rule, priority determines the order in which the conditions are evaluated, starting with the lowest integer and ascending.
uses_per_order_limitintegerThe number of times a given BUY_X_GET_Y discount can be applied to a customer cart.
buy_product_selectionobjectDefines the set of product items eligible for a BUY_X_GET_Y discount.

Condition types

Price Rules conditions fall into two broad categories: those for targeting customers and those for offering quantity pricing.

Customer-targeted condition types

TypeDescriptionChild propertiesExample use case
CUSTOMER_GROUPTargets customers based on their membership in groups created on your storefront’s ecommerce platform.type, value, operatorPromotions for first-time customers.
CUSTOMER_IDTargets customers who are logged into the store based on the customer ID found in the ecommerce platform.type, valuePromotions for members of a brand loyalty program.
REF_URLTargets customers based on the URL in the referer header of their HTTP request to your storefront.type, valuePromotions for customers who visit your store from a partner website.
SOURCETargets customers based on the value of a custom parameter in the link used to visit your storefront.type, valuePromotions for customers who visit your store from an email campaign.

Quantity-pricing condition types

TypeDescriptionChild propertiesExample use case
QTY_BY_VARIANTOffers discounts based on the quantity of a product variant in the cart.type, value, operatorA promotion of “Buy 3 packs of 100 reusable cups (Red Color) to get a $10.00 discount on your purchase”.
QTY_BY_PRODUCTOffers discounts based on the number of products in the cart.type, value, operatorA promotion of “Buy 6 packs of 20 disposable spoons and get a discount of 5% on your purchase”.
QTY_BY_LINEOffers discounts based on the total number of items, products or variants, in the cart.type, value, operatorA promotion of “Buy 10 items and get a discount of $3.00”.
BUY_X_GET_YOffers discounts on Y items based on the presence of X items in the cart.type, buy_quantity, get_quantity, priority, uses_per_order_limit, buy_product_selectionA promotion of “Buy a pack of 100 tea bags and get a teacup at 50% discount”.
ORDER_CONDITIONOffers discounts to customers based on a specific shipping address defined within zones. For more information, refer to Create an order condition.type, value, nameA promotion of “10% reduction in shipping cost for downtown addresses”.
LINE_ITEM_PROPERTYOffers discounts to customers based on the properties of the items in the cart.type, value, nameA promotion of “Buy a ‘Red’ Jacket and get $1.00 off on your purchase”.
SPEND_X_GET_YOffers discounts on Y items if the cart total is equal to or above X price. For more information and an example, refer to the Quantity Pricing page.type, operator, valueA promotion of “Spend $100, get a free bag”.

Cart-level condition types

TypeDescriptionChild propertiesExample use case
CART_LEVEL_DISCOUNT_CONDITIONOffers discounts based on the subtotal of the customer's carttype, value, operatorA promotion of "Spend $150 or more to get 10% of your entire purchase.