I have created a custom commerce order status called 'Sent'.
When an existing order is updated from 'Invoiced' to 'Sent' I have a custom message type ('Order sent') and, using Rules, a custom rule which creates a message entity and sends the 'Order sent' message.
The rule is as follows:
{ "commerce_message_commerce_order_message_order_sent_e_mail" : {
"LABEL" : "Commerce order message: order sent e-mail",
"PLUGIN" : "reaction rule",
"WEIGHT" : "3",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "message_notify", "entity" ],
"ON" : { "commerce_order_update" : [] },
"IF" : [
{ "data_is" : { "data" : [ "commerce-order:status" ], "value" : "sent" } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "message",
"param_type" : "commerce_order_order_sent",
"param_user" : [ "commerce-order:owner" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:field-ds-message-commerce-order" ],
"value" : [ "commerce-order" ]
}
},
{ "entity_save" : { "data" : [ "entity-created" ], "immediate" : "1" } },
{ "message_notify_process" : {
"message" : [ "entity-created" ],
"save_on_fail" : "0",
"save_on_success" : "0"
}
}
]
}
}
At the moment, I am receiving 3 duplicate emails and can't work out why?