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:
- 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.
- Not understanding how to bring related fields and entities into scope: Read the FAQ about bringing fields into scope from the Drupal Commerce FAQ.
- 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: