This article explains how to create order rules that apply only when certain conditions are met.
DropStream order rules are statements that instruct the rule engine to perform various actions on orders, either to transform the orders by changing the values of their attributes, or to filter out certain orders from fulfillment.
The actions can be performed unconditionally on all orders or on all order items, or conditionally, dependent on certain conditions. Those conditions are expressed as IF statements and the consequent rule applications as THEN statements. An IF-THEN statement evaluates whether the condition expressed in the IF statement is true, and if it is, does something that is expressed in the THEN statement.
IF and THEN keywords are inserted automatically in the GUI Editor but need to be specified in the rule source code in the Advanced Editor, where they are represented by when
and then
keywords, respectively, and end with an end
keyword. See the When/then article for more details.
Note: In DropStream, rules that apply unconditionally are represented as as a special case of conditional rules, namely as rules that apply always, in all conditions.
Both unconditional and conditional rules are created in the same way.
- Open your store.
- Go to the Rules tab.
- Click +Add rule.
- Name your rule and click +Add action.
- Select Condition from the dropdown menu.
- If you would like to create an unconditional rule, select Always from the dropdown next to IF.
- Alternatively, if you would like to create a conditional rule, select Compare Order attribute from the dropdown next to IF and define your condition.
This will create a simple condition. You have also an option to create a complex condition as a boolean combination of conditions, or as a quantified condition that applies to a limited number of items in the order.
- After establishing your condition, click Add action next to THEN, and state the action that your rule should take as the consequence of the rule.
- Click Save changes to save the rule.
Comments
Please sign in to leave a comment.