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?

2 Answers 2

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).

1
  • You can change the output of [commerce-order:commerce_line_items] so that it includes all line items (such as shipping, tax). See link Commented Feb 6, 2015 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.

2
  • 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? Commented Jun 8, 2016 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
    Commented Jun 9, 2016 at 12:33

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.