Created
October 26, 2012 02:19
-
-
Save ogredude/3956559 to your computer and use it in GitHub Desktop.
Drupal Commerce Rules to send an update email to customer on order status change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "rules_automatic_update_notification_email" : { | |
"LABEL" : "Automatic update notification email", | |
"PLUGIN" : "rule set", | |
"REQUIRES" : [ "rules" ], | |
"USES VARIABLES" : { "order" : { "label" : "Order", "type" : "commerce_order" } }, | |
"RULES" : [ | |
{ "RULE" : { | |
"PROVIDE" : { "entity_fetched" : { "billing_profile" : "Billing profile" } }, | |
"IF" : [ | |
{ "entity_has_field" : { "entity" : [ "order" ], "field" : "commerce_customer_billing" } } | |
], | |
"DO" : [ | |
{ "entity_fetch" : { | |
"USING" : { | |
"type" : "commerce_customer_profile", | |
"id" : [ "order:commerce-customer-billing:profile-id" ] | |
}, | |
"PROVIDE" : { "entity_fetched" : { "billing_profile" : "Billing profile" } } | |
} | |
} | |
], | |
"LABEL" : "Fetch billing profile" | |
} | |
}, | |
{ "RULE" : { | |
"IF" : [ | |
{ "entity_has_field" : { | |
"entity" : [ "billing-profile" ], | |
"field" : "commerce_customer_address" | |
} | |
} | |
], | |
"DO" : [ | |
{ "mail" : { | |
"to" : [ "order:mail" ], | |
"subject" : "[STORE NAME] Order #[order:order-number] status updated", | |
"message" : "Hello [billing-profile:commerce-customer-address:name-line],\u000D\u000A\u000D\u000AYour order #[order:order-number] has been updated. Its status is now [order:status].\u000D\u000A\u000D\u000AThanks again for shopping with STORE NAME, and remember if you need additional information or assistance with your order, you can \u003Ca href=\u0022[site:url]contact\u002Fcontact-us\u0022\u003Econtact us online\u003C\u002Fa\u003E or phone us at (###) ###-####\u000D\u000A\u000D\u000AThanks!\u000D\u000A\u000D\u000A--The STORE NAME Team", | |
"language" : [ "" ] | |
} | |
} | |
], | |
"LABEL" : "Send the email" | |
} | |
} | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "rules_send_automatic_order_update_notification" : { | |
"LABEL" : "Send automatic order update notification", | |
"PLUGIN" : "reaction rule", | |
"TAGS" : [ "commerce" ], | |
"REQUIRES" : [ "rules", "entity" ], | |
"ON" : [ "commerce_order_presave" ], | |
"IF" : [ | |
{ "NOT data_is" : { | |
"data" : [ "commerce-order:status" ], | |
"value" : [ "commerce-order-unchanged:status" ] | |
} | |
} | |
], | |
"DO" : [ | |
{ "component_rules_automatic_update_notification_email" : { "order" : [ "commerce-order" ] } } | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
many thanks for the tip, how can you adjust multilingual example German and English