Send email when order status is changed to complete
Hello, I would like to know if it is possible to send an email to the customer when their order status is changed from pending to complete.
It would be nice to inform the customer when their order is shipped.
Comments
Yes, You can do this with
Yes, You can do this with Rules.
Can you be a litte bit more
Can you be a litte bit more specific? What rules event must I use and are there any conditions that needs to be specified?
Create a rule with event
Create a rule with event After updating an existing commerce order
Create action system send mail to order:email (use patterns)
Add condition
Execute custom PHP code
put this code inside
if([commerce-order:status] == 'completed') return TRUE;
else return FALSE;
Thanks, it works! The only
Thanks, it works!
The only problem is the fact that the customer gets an email everytime the order is saved if the order status is complete.
I changed the condition a bit
I changed the condition a bit to suit my needs. Now the customer only gets an email notification if the order status is changed to complete.
if("[commerce-order:status]" == "completed" && "[commerce-order-unchanged:status]" != "[commerce-order:status]") {
return TRUE;
}
else {
return FALSE;
}
Thanks !!!!!!!!!!
Perfect.
Thanks!!!
From Brazil, Rio de Janeiro :D
Or just
Or just
return ("[commerce-order:status]" == "completed" && "[commerce-order-unchanged:status]" != "[commerce-order:status]");
No "Execute custom PHP code" option ?
Hi
I know this thread was created while agot and not sure how much has changed but I am having troubles finding
"Execute custom PHP code" option ?
Info Drupal 7.27
Info Install profile Commerce Kickstart (commerce_kickstart-7.x-2.14)
All components look reasonable up to date ?
Enable Drupal core's "PHP filter" module
Hi Kris,
I'm not sure if you're still having problems with this but I thought that it could be useful to someone else even if you've found out how to do it.
In order to see the "Execute custom PHP code" in the Condition select box you first need to enable the core module "PHP filter" - go to Site settings/Modules (the address will be yoursite/admin/modules) find the module, enable it and save it. The next time you add a condition you will see the "Execute custom PHP code option" under "PHP" in the list.
I hope this helps.
I am pretty sure this can
I am pretty sure this can also be done by adding the condition:
Data Comparison:
Parameter: Data to compare: [commerce-order:status], Data value: Completed
But, this does still send the email every time the order is saved. To get around this and to add a bit of flexibility for the user, I added a couple of custom fields.
1. field_send_com (Values = N/A, Tracking Number and Message) This field controls if the message actually gets sent, as well as which message to send.
2. field_order_com (this is a text area to send a custom message to the customer)
Next I created a rule for sending the tracking number, and a rule for sending messages.
Event: After updating an existing commerce order
Condition:
Entity has field
Parameter: Entity: [commerce-order], Field: field_send_com
Data comparison
Parameter: Data to compare: [commerce-order:field-send..., Data value: Message
Action:
Send mail
Parameter: To: [commerce-order:mail
The detail of the message can be edited in the message body, can be tokenized etc.
I did the same thing for the tracking number.
Sorry I dont'understand
Sorry I don't' understand were you create the two fields: field_send_com, field_order_com.
Can you help me?
Thanks
custom fields
I also would like to know where to add the custom fields please.
Thanks in advance!
Thanks for this post, so used
Thanks for this post, so used to ubercart didn't even realise emails would not be sent at each stage.
Maybe my site will be ready soon.
Sue www.redboxlingerie.com
Thanks
HenrikBak and spypolo, Thanks for this solution
Thanks
Serious thanks to all on this thread. Spent 4 hours on this last night and then found this today and fixed it up in 5 minutes. Awesome indeed and www.balancebikes.ca appreciates it. Now to get the email after XX days from order sorted.
thanks
Thanks! It is working for me too so I shouldn't sit on the pc all night :)