Conditions
How to set a rule's conditions and what are the required and optional parameters to set
Last updated
How to set a rule's conditions and what are the required and optional parameters to set
Last updated
For each rule you need to provide one or more conditions
as an array of condition objects.
Conditions determine when a rule's are triggered by defining the criteria that must be met for the rule to be applied. They can check for specific values, quantities, or any other attributes of the involved resources and their relationships.
For performance reasons, the maximum number of conditions within a rules payload is 50.
For each condition you must define at least the involved field and the matcher to be used to compare that field's value against the desired one (if any). Additional parameters can be also specified:
field
The resource's field on which to evaluate the condition (expressed in dot notation). Must be an attribute, cannot be a resource.
"order.line_items.tags.name"
matcher
"eq"
value
true
2000
"summer-sale"
[ "2018-01-01T00:00:00+02:00", "2018-03-31T23:59:00+02:00" ]
{ "in_or": [ "men", "women" ], "not_in_and": [ "sales", "vip" ] }
scope
"any"
group
"discountable-items"
aggregations
Additional requirements on the aggregated matches of the conditions.
nested
Additional conditions to be met by the matches of the parent condition.
Referring to the , a condition field
must be an attribute — i.e. the last leaf of the relationship tree using the dot notation (e.g. it can be order.line_items.sku.code
but it cannot be order.line_items.skus
or just order
). Some related to the currently issued JWT token are also enabled.
Assuming no conditions_logic
is specified at the level, the following couple of conditions check if an order is tagged as dropship
and contains at least a line item whose SKU code starts with TSHIRT
. The matching line items are grouped as tshirts
so that the related actions (that will be triggered only if both conditions are satisfied) can be applied only to the line items that matches the second condition:
The matcher to be used against the field and value (check the ).
The value to be compared with the field value according to the matcher
(required for , unavailable for ). are also allowed.
The policy to determine if the condition is a match. Can be one of any
or all
, default is all
(more information ).
A label to identify the matches of the condition (if not specified a random UUID will be automatically generated and added by the ).
Learn more .
Learn more .