Conditional Actions

Last updated on
4 October 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites


Conditional Actions are only used in the Drupal 6 version of Ubercart. In Drupal 5, Ubercart used a module called Workflow-NG. In Drupal 7, Ubercart uses the Rules module to achieve these same results.

The Conditional Actions module is at the heart of how your Ubercart store makes certain decisions and performs various actions. For example, it allows you to decide through a web interface who should be charged a specific tax, when free shipping should be made available, and what happens to orders once they've been paid for. Normally these things require custom coding to accomplish, but the user interface provided by the Conditional Actions system lets anyone build this business logic into their Ubercart store.

Conditional Actions Overview

Before reading through this documentation and setting up your store, please familiarize yourself with these terms. Users of Ubercart 1.x will be familiar with these concepts, as Conditional Actions was developed as a core replacement for the Workflow-ng module.

In Conditional Actions, a combination of a trigger + conditions + actions is called a predicate. If you're a grammar buff, you'll recognize that the predicate is the part of a sentence containing an action (or set of actions) and its modifiers. In English, a full Conditional Actions predicate would be something like, "When a payment gets entered for an order then if the order balance is less than or equal to $0 update the order status to Payment received."

Breaking apart that sentence, we can see first the trigger, "When a payment gets entered for an order." Triggers are basically events that occur when Ubercart is performing some sort of action and wants to see that is triggered in the Ubercart code related to something that is happening in the store. A trigger can be something like "Customer completes checkout" or "A payment gets entered for an order." Ubercart will "pull" the trigger, causing all the predicates using this trigger to be loaded and evaluated.

The second part of the sentence above is the condition, "If the order balance is less than or equal to $0." When a predicate is evaluated, it must meet a certain set of conditions. These can be simple conditions like this one or complex sets of conditions and condition groups. In this example, if the order was not paid in full, then the evaluation process for the predicate will be halted and the actions will not be performed.

The third part of the sentence is the action, "Update the order status to Payment received." The action or set of actions will be performed if the conditions for the predicate are met. Actions can be configured, so this example might have instead updated the order status to Completed.

Where do triggers, conditions, and actions come from?

These basic components of the Conditional Actions system are defined in the various core and contributed Ubercart modules. Some predicates are defined by default that you can modify if you need slightly different behavior out of your Ubercart store. New options might be made available as you perform specific actions when configuring your site, like adding shipping quote methods and taxes. The user interface allows you to alter these default predicates or create your own to deal with your business needs.

To learn more about those things, simply read through this guide along with an Ubercart install.

Help improve this page

Page status: No known problems

You can: