I installed Drupal Commerce Kickstart 2 with drupal version 7.54 and drupal commerce Version: 7.x-1.14. My problem is I want to send email to the store owner every time an order is completed. So in CheckOut Rules, I created a rule Commerce order message: order notification e-mail.

My Event is Completing the CheckOut Process. My Action is to Send Mail but in the To field, I could not find the right replacement pattern I need. The referenced custom field field_store_email_address was not available there. Below is the setup

My website sells Pizza, so I have a Pizza content type. In the Pizza content type my fields are Store(field_store) and I will not name other unrelated fields. The field_store in my Pizza content type is a term reference to a vocabulary taxonomy Store. In the taxonomy Store, it has a field store_email_address(field_store_email_address). field_store_email_address is where I want to send my email.

When the checkout process is completed, I want to send an email to unique store owners of items included in the order. So my question here is how will I formulate my Conditions Rules? Please help me.

  • 1
    Drupal and Commerce versions? May 5 '19 at 12:00
  • @IsmailCherri--> I installed Drupal Commerce Kickstart 2 with drupal version 7.54 and drupal commerce Version: 7.x-1.14 May 5 '19 at 12:19

D7, install Conditional rules module, this module let's you add aditional conditions at action section in rules UI.

You say your event is 'checkout proccess', so, the first thing you need is to load your 'pizza' node object in to rules, I am assuming that you have a field in your product-fields referencing to your 'pizza-content-type'.

To do this, in actions UI add a conditional, add and if, entity has field, your product-field that is referencing to pizza-content-type, if true (always be true, but you need this so rules can load your pizza-node), then fetch entity-by-id, your pizza-node, now you have pizza-object available

Add another conditional, add another if, entity has field, your taxonomy-term related to taxonomy store, then, fetch entity by id, your taxonomy term, now you have available taxonomy term related to store, then add a conditional, entity has field, your taxonomy-term field_store_email_address, and now you have now available field_store_email_address value in rules, send your email, done.

Here is an img that look alike what your rules action will look. enter image description here

  • Thanks, I tried your suggestion but every time I install Conditional rules Module using drush, my site crashes. Good thing I have my database backup. May 8 '19 at 2:42
  • I installed it using the command drush en rules_conditional May 8 '19 at 2:44
  • 1
    install rules Development version: 7.x-2.x-dev, or Version: 7.x-2.11, then conditional rules, to avoid updating rules version install drupal.org/project/disable_updates
    – pinueve
    May 8 '19 at 3:16
  • 1
    is there anything else you need from me to accomplish your task?
    – pinueve
    May 11 '19 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.