An order event rule is a defined series of actions based on conditions. If the conditions evaluate as successful/true, actions for changing customer type, setting custom fields and other tasks can be automated.
The Order Event rule engine is a powerful feature. These are some of the things that can be automated with the engine:
- Add Customers to Drip Series Email Campaigns
- Give Reward Points to Customers
- Change Customer Type
- Change Adcodes
- Change Affiliates
- Send out email templates
Components of a Rule: Responds To, Conditions and Actions
This section is for when the engine checks to see if the conditions are true. The order engine will run checks at four different times:
- A New order is placed or created - The engine checks for conditions when a new order is placed or created.
- An Existing order is updated - The engine checks for conditions when an existing order is updated.
- An order is deleted - The engine checks for conditions when an order is deleted.
- The timed follow-up for an order is triggered - When a timed follow-up is triggered, the engine checks to see if the conditions are true.
Conditions are what the rule is looking for to trigger. If a customer checks out, and he falls under a specific condition, the actions would take place.
The Following Conditions can be used:
- Ad Code – Checks the incoming AdCode against a defined value to see if it matches. Can be set to * to match any value.
- Affiliate Code – Checks the incoming Affiliate Code against a defined value to see if it matches. Can be set to * to match any value.
- Category in Order - Checks the categories on all the products in the order to see if there is a match.
- Check Customer-Level Custom Field - Checks a custom field at the customer level.
- Check Order-Level Custom Field - Checks a custom field at the order level.
- Check Store-Level Custom Field - Checks a custom field at the store level.
- Current Order Status - Checks the status of the order.
- Customer Type - Checks to see if a customer is of a certain type.
- Default to True - Makes the condition true, so the actions are triggered automatically.
- Email Template not sent to Customer Yet - Checks to see if the customer has received a specific email template.
- Is Admin User - Checks to see if the visitor making an order is an administrator.
- Manufacturer in Order - Checks to see if a manufacturer is attached to a product in the order.
- Order Payment Gateway Response Code - Checks the Gateway Response Code returned from payment verification.
- Order Tax Amount - Checks the amount of tax for the order.
- Order Total - Checks the total amount for the order.
- Order Type - Checks to see the type of order.
- Previous Order Status - Checks the users previous order status.
- Product in Order - Checks to see if a certain product is in the order.
- Sales Person User - Determines if a sales person was attached to an order.
- Shipping Method Selected - Checks to see if a specific shipping method has been selected.
- Source - Checks the source for a specified text value.
- Source Group - Checks to see if anything belongs in a certain Source Group.
- Store - Checks the store the customer is checking out from.
- Time Since Created - Checks the amount of time since the order has been created.
- Time Since Last Change - Checks the amount of time since the order has had a change.
- Time Since Order Status Change - Checks the amount of time since the order status has changed.
The conditions can be evaluated on an ANY or ALL basis. An ANY will pass if any 1 of the conditions are matched and will perform the actions set. An ALL match requires ALL conditions to match before running the action.
Each rule can contain one or more of those conditions. Depending on the conditions set, if the rule is successful, then all of the actions set on the rule will apply.
The following Actions can be applied:
- Add Customer to Drip Series - Puts the customer on a mailing list for a Drip Series Email Campaign.
- Change Order Status - Changes the order status to a different type.
- Give Reward Points to Customer - Give a specified amount of reward points to the customer.
- Remove Customer from Drip Series - The the customer off the mailing list for a Drip Series Email Campaign.
- Send Email Template to Addresses - Automatically sends an email template to the specified addresses.
- Send Email Template to Customer - Automatically sends an email template to the customer.
- Send Email Template to Email Alert Addresses - Sends out an email template to all the alert email addresses. These can be changed in Settings>Store Information>Notifications/Alerts.
- Set Adcode - Sets the Adcode for the customer session to whatever you designate.
- Set Affiliate - Changes the Affiliate for the customer session to whatever you designate.
- Set Customer Type - Changes the type of customer to whatever type is specified.
- Set Customer-level Custom Field - Makes a change to a customer level custom field.
- Set Order-level Custom Field - Makes a change to an order level custom field.
- Set Source - Sets the source to the specified text value.
- Set Source Group - Sets Source Group, to the specified text value. This is a grouped field used to group multiple sources that have a common more general source (such as “Google" being the source would have "Search Engine" as the Source Group, or Shopzilla would have the "Comparison Engine" group). This allows you to see your primary sales channels on reports.
- Set Store-level Custom Field - Makes a change to a store level custom field.
Rules are loaded when a session starts and currently cached for 5 minutes, or until the rules are next updated via the admin console.
How to Setup Rules:
Browse to Tools > Power Features > Rule Engine > Order Events
Select "New" or the edit button for an existing rule.
Define the Rule:
- Name the Rule and choose whether to make it active and what to respond to.
- Save and you will now be able to set the conditions and actions.
- Setup your conditions and actions to perform the desired task.
Note: By Default Rules are sorted alphabetically and run and apply in the exact order that they are listed. Since rules override each other, the last rule overrides any previous rules. If you have a condition that evaluates as true for two separate rules and the Action is the same field (example setting a Source or Source Group), the last rule overrides any other preceeding it. You can use the Sort Order to define which rule should apply.
Check out these other articles on the Rule Engine: