Created
October 26, 2012 02:20
-
-
Save ogredude/3956560 to your computer and use it in GitHub Desktop.
Drupal Commerce Rules Component to send an email to the customer
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_message_to_customer" : { | |
"LABEL" : "Send message to customer", | |
"PLUGIN" : "rule set", | |
"REQUIRES" : [ "rules" ], | |
"USES VARIABLES" : { | |
"order" : { "label" : "Order", "type" : "commerce_order" }, | |
"subject" : { "label" : "Subject", "type" : "text" }, | |
"body" : { "label" : "Body", "type" : "text" } | |
}, | |
"RULES" : [ | |
{ "RULE" : { | |
"PROVIDE" : { "entity_fetched" : { "customer_billing_profile" : "Customer 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" : { "customer_billing_profile" : "Customer billing profile" } } | |
} | |
} | |
], | |
"LABEL" : "Fetch the billing profile" | |
} | |
}, | |
{ "RULE" : { | |
"IF" : [ | |
{ "entity_has_field" : { | |
"entity" : [ "customer-billing-profile" ], | |
"field" : "commerce_customer_address" | |
} | |
} | |
], | |
"DO" : [ | |
{ "mail" : { | |
"to" : [ "order:mail" ], | |
"subject" : "[STORE NAME] Order update: [order:order-number] - [subject:value]", | |
"message" : "Hello [customer-billing-profile:commerce-customer-address:name-line],\u000D\u000A\u000D\u000AOur team has new information about your order #[order:order-number].\u000D\u000A\u000D\u000A[body:value]\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" | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment