How to Send an email with the list of products ordered in its body? I created a rule and a component, to send an email to my customers 7 days after their orders. This email asks them to leave a comment on the products they have purchased.

My problem: I can not retrieve the list of products in the email. With [order:commerce_line_items], the e-mail displays "No order items found".

Here is the export of my rule :

{ "rules_schedule_follow_up_email" : {
    "LABEL" : "Schedule follow-up email",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler", "entity" ],
    "ON" : { "commerce_order_update" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "commerce-order:status" ], "value" : "processing" } }
    ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_send_follow_up_email",
          "date" : "now",
          "identifier" : "Follow-up email for [commerce-order:order-id]",
          "param_order" : [ "commerce-order" ]
        }
      }
    ]
  }
}


Here is the export of my component :

{ "rules_send_follow_up_email" : {
    "LABEL" : "Send follow-up email",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "order" : { "label" : "Order", "type" : "commerce_order" } },
    "ACTION SET" : [
      { "mail" : {
          "to" : "[order:mail]",
          "subject" : "Votre avis nous int\u00e9resse",
          "message" : "[order:owner],\r\n\r\n\r\nvous recevez ce courriel car vous avez r\u00e9cemment fait un achat sur notre site. Nous aimerions avoir votre avis sur les produits que vous avez command\u00e9.\r\nC\u0027est simple et rapide, il vous suffit de cliquez sur les liens ci-dessous :\r\n\r\n[order:view-url]\r\n\r\n[order:commerce_line_items]\r\n\r\nMerci pour votre retour d\u2019exp\u00e9rience. Nous appr\u00e9cions le temps que vous prenez et nous l\u0027utiliserons activement pour am\u00e9liorer notre boutique. \r\n\r\n\r\nCordialement,\r\nL\u0027\u00e9quipe [site:name]\r\n[site:url]\r\n\r\nPour rester inform\u00e9 des nouveaut\u00e9s et b\u00e9n\u00e9ficier de nos offres promotionnelles, suivez-nous sur :\r\nhttps:\/\/www.facebook.com\/S1biosecom\r\nhttps:\/\/twitter.com\/S1biosecom\r\nhttps:\/\/plus.google.com\/+S1biosecom\r\nhttps:\/\/www.pinterest.com\/S1biosecom\r\n\r\nPS : ceci est un mail automatique, merci de ne pas y r\u00e9pondre.",
          "language" : [ "order:owner:language" ]
        }
      }
    ]
  }
}


I want to display in my email, the links to the product pages ordered by my client. How can I do so?
If what you're looking for (= the list of products) is not available, then just (a) make it available first and (b) wait with your Schedule Rules Component action (to send an eMail) until it is available. Read on for more details ...

The trick to do so is similar to what is shown in the Rules example included in my answer to "How to concatenate all token values of a list in a single field within a Rules loop?". In your case, you could make it work like so:


Add some new Rules variable that will be used later on as part of the eMail body, before the Rules Action to schedule the Rules Component. Say you name the variable prod_list_var_for_email_body.
Add a loop to iterate over the list of links to the product pages. Within that loop, for each iteration, prepend or append the value for each list_item to that variable prod_list_var_for_email_body (see where we're going???).
Make sure that the Schedule Rules Component action is your last Rules Action, after the loop completed. And finetune the details (configuration) of your Rules Action to Schedule Rules Component. When doing so, you'll be able to select the token for file_list_var_for_email_body to include anywhere in your eMail body.


Easy, no?