I am using Drupal 7 with Ubercart. I am trying to configure to send an email when customer makes a purchase of a product mapped to one particular taxonomy term.

I tried adding actions in a custom rule (created with Rules). But there is no such action available to check the product field values or based on taxonomy terms.

Is there any alternative ways to check product fields in Rules actions?

  • Have you tried the 'Entity has field' condition to check for your taxonomy term? Jul 2, 2013 at 14:25
  • I tried that, but I have to check for a value in the field.
    – AnAnD
    Jul 4, 2013 at 7:45
  • Did you find a solution for this?
    – hockey2112
    May 22, 2014 at 14:15
  • @hockey2112 : I think my answer provides a solution now ... Oct 21, 2016 at 16:21

1 Answer 1


Have a look at this, rather basic, rule (in Rules export format):

{ "rules_check_taxonomy_term" : {
    "LABEL" : "Check Taxonomy Term",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert" : [], "node_update" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_tags" } },
      { "list_contains" : { "list" : [ "node:field-tags" ], "item" : "21" } }
    "DO" : [
      { "drupal_message" : { "message" : "A node containing the tag [node:field_tags] just got created or updated." } }

Here is what this rule does:

  • Rules Event: After saving new content, After updating existing content
  • Rules Conditions:

    • Entity has field "field_tags", which is the machine name of the term reference field I want to check for.
    • List contains item "node:field-tags" and with Taxonomy term identifier value "21" (which is the term id of the term I want to check in this Rules Condition).
  • Rules Action: Show a message on the site (which is "A node containing the tag [node:field_tags] just got created or updated." (with [node:field_tags] the actual term with term id = 21).

What is crucial in the above rules example in the context of this question, are the 2 Rules Conditions.

Use the Rules UI to import the above rule in your site. Here are the tweaks you'll need to make it fit your case:

  • Replace the Rules Event with an event that matches your "when customer makes a purchase of a product".
  • Within the Rules Conditions, perform these changes:

    • replace the "node" entity with your entity.
    • replace the machine name of term reference "field_tags", and adapt the "term id" to fit your case.
  • Replace the Rules Action by "send an appropriate eMail".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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