2

I want to send an e-mail that contains the content of a user's Drupal Commerce order (the line items) with Rules.

I tried modifying the default Send an order notification e-mail (in Rules) provided by Commerce. I noticed that there was a [commerce-order:commerce_line_items] token, but when I insert this into an e-mail, I get a message of No line items found when the e-mail is sent, even though the order has line items. What am I doing wrong?

3

The [commerce-order:commerce_line_items] token does not work when Completing the checkout process, which is the event for which the Send an order notification e-mail rule is triggered.

Instead, one way to do this is to use the Commerce E-mail module, which provides a [commerce-order:commerce-email-order-items] token and a new interface for editing the e-mail. Note that you will need to disable the e-mail-sending rule when using this module (or else you will get duplicate e-mails, as the module help points out).

  • You can change the output of [commerce-order:commerce_line_items] so that it includes all line items (such as shipping, tax). See link – Channel Islander Feb 6 '15 at 20:30
0

If you are using the Message module together with Commerce Message and Message Notify, another way of doing this would be to simply use the token !order-summary in the commerce_order_order_confirmation message type provided by the module Commerce Message.

All you have to do is edit the message type at the following URL and add the token in the corresponding field:

admin/structure/messages/manage/commerce_order_order_confirmation

The rule Commerce order message: order notification e-mail will then send an e-mail after checkout is completed which will include the line items.

  • Hi @Bmunslow. Any idea why the Commerce order message: order notification e-mail rule could be missing in a commerce site w. commerce message installed? Can you export the rule? – Kristoffer Rom Jun 8 '16 at 21:12
  • 1
    @KristofferRom I have no idea why that rule would be missing from your setup. Make sure it hasn't been disabled. I once had an issues with rules disappearing as well, it was due to a complex i18n setup... I can't paste the full rule in this comments... You can copy / paste from here: http://pastebin.com/rvvpywX8 – bmunslow Jun 9 '16 at 12:33

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.