This project aims to be a library of Rules events, conditions and actions for Drupal Commerce. Actively maintained and tested on a large eCommerce site. We are always seeking collaboration with other Rules based DC modules.

Project Motivation

My wish is to merge all modules based on Rules and Drupal Commerce in a single one. We are looking to collaborate with other modules that provide Rules for Drupal Commerce.

Any contribution is welcome!

Explanation of module capabilities

  • Rules events
    • Process checkout page : Fires when a checkout page is processed
    • Process checkout pane: Fires when a pane is processed during checkout process
    • Line item quantity has changed (occurs when adding or removing a product to cart and when an amount has been modified in the cart form).
  • Rules conditions
    • Total amount of selected products comparison
    • Total quantity of selected products comparison
    • Line item and another entity have matching terms: Check if a line item's product and another entity both reference the same term id
    • Line item product has term(s): Test if a line item has a product with a specified term
    • Total product with term quantity comparison: Total of products with term and with a specified quantity
    • Total product of type quantity comparison: Total of products of specified type and with a specified quantity
    • Total product of type amount comparison: Total of products of specified type and
      with a specified amount
  • Rules actions
    • Change checkout page properties: Alter page attributes (Title, Help, and Submit Button Text)
    • Get the original price of the product from the line item: Returns the original unit price of the product (in integer format) before any prior manipulations by other rules
    • Add line item to cart : It would appear that this is unnecessary, but if you use the rules built in to add a line item to the order it is not updated correctly, see #2108669: Cannot attach line items to order via rules
    • Change pane properties : Change visibility, page, weight of a pane
    • Get the referencing node from the line item: Set the referenced node (product display) into a variable to be reused in another action

Code Browsing

Want to take a look a the code of this module? We replicate the Drupal.org Git repository to Bitbucket which has a little nicer tools for browsing code. Pull requests are not honored on Bitbucket, please do those here.

Also located on Github as well.

Example

With this module, you can alter the visibility of a pane "Billing information" if an order has a product of type MyProduct.
Create a new rule with:

  1. Event : Select "Process checkout pane"
  2. Condition : Add "Total product of type quantity comparison" condition and choose "MyProduct" as product type". Set ">=" as operator and 1 as quantity
  3. Action : add "Change pane properties" and select "Billing informations" as pane, and uncheck "Enabled"

Now billing information pane will not be shown if the order has a product of type MyProduct.

Version 2.x

Version 2.1beta1 and beyond is a complete refactoring of code to provide better documentation and to also bring this module up to Drupal Coding Standards. Please review UPGRADING.txt for details.

In version 2 total comparison (quantity and amount) now can be done by term(s) and/or by product type. Terms selection is done by Ajax.
These conditions have been renamed to Total amount of selected products comparison and Total quantity of selected products comparison.
"Line item product has term" has been merged into "Line item product has terms too".

It is a fork of Commerce Extra Rules Conditions which seems not to be maintained.

Version 1.x

With the release of 2.1 beta, the branch 1.x has been deprecated. We will no longer make patches to the 1.x branch as that has many coding issues. Upgrading to 2.x is a small amount of work but the module is improved drastically with better documentation and has been brought up to Drupal coding standards.

Rule Module Compatibility

Commerce Rules Extra is only tested on Rules Version 2.7. Rules version 2.8 is not compatible with Drupal Commerce; therefore, Commerce Guys state that Drupal Commerce can only run with Rules version 2.7. This issue is documented in issues on Drupal.org.
#2407897: Product pricing rules fail with Rules 7.x-2.8 [use Rules 2.9]
#2410341: The problem with the discount on Commerce version 7.x-1.11
#2403851: Drupal Commerce is broken with Rules 7.x-2.8

We will be taking a look at Rules 2.9 and 2.x-dev. This is being tracked in this issue: #2455303: Compatibility for Rules 7.x-2.9 or 7.x-2.x-dev

Supporting organizations: 
Funding

Project information

Releases