Custom Email Notifications in Drupal Commerce (screencast)

This screencast demonstrates how to do custom per-product email notifications. After adding a multivalued "notification" field to the product, we can check through the order on order completion to see if there are products which have product owners who need to be notified. The logic is "When the checkout process is completed", Loop through the line items in the order. For each line item, call a component (a Rules subroutine) that checks to see if the line item is associated with a product, and if so, if it has notification fields filled out. If so, the action is to loop through the emails in the multivalued notification field and send a tokenized email to each one.

Before getting started I mention the three things that persistently give people trouble with Commerce and Rules, and some solutions:

  1. Not understanding rules in the first place: Spend a few hours starting from the beginning with Itangalo's outstanding "Learn the Rules Framework" video series.
  2. Not understanding how to bring related fields and entities into scope: Read the FAQ about bringing fields into scope from the Drupal Commerce FAQ.
  3. Not understanding how to use conditions in a loop or how to use Rules Components (subroutines), which is something we'll demonstrate here.

Here's the screencast:

Posted January 30, 2012

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
X
In 2019 Commerce Guys rebranded to Centarro.

Change is at the center of eCommerce, but our team and mission remain the same.

Our consulting, development, and support offerings apply our expertise to help you adapt to change and grow.

Find us now at: https://www.centarro.io