IF-THEN Statements in Order Rules

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.

  1. Open your store.
  2. Go to the Rules tab.

    DropStream - Rules

  3. Click +Add rule.

    DropStream - Add a rule

  4. Name your rule and click +Add action.

    DropStream - Name the rule

  5. Select Condition from the dropdown menu.

    DropStream - Select Condition
  6. If you would like to create an unconditional rule, select Always from the dropdown next to IF.

    DropStream - No preconditions
  7. Alternatively, if you would like to create a conditional rule, select Compare Order attribute from the dropdown next to IF and define your condition.

    DropStream - Add a 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.
  8. 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.

    DropStream - Add a consequence
  9. Click Save changes to save the rule.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.