-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathask-for-reviews-a-week-after-order-fulfillment.json
28 lines (28 loc) · 5.12 KB
/
ask-for-reviews-a-week-after-order-fulfillment.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"docs": "Follow up with your customers automatically, and establish the purchase -> earn-reviews -> attract-customers cycle. This task comes prefilled with a friendly, customizable email that gives the customer direct links to their purchases on your website, where they can leave a review using your existing review system.",
"halt_action_run_sequence_on_error": false,
"name": "Ask for reviews a week after order fulfillment",
"online_store_javascript": null,
"options": {
"days_to_wait_before_emailing__number_required": 7,
"only_send_to_customers_who_have_accepted_marketing__boolean": true,
"customer_tag_to_add_after_sending": null,
"ignore_customers_having_this_tag": null,
"ignore_orders_having_this_tag": null,
"email_subject__required": "Will you review your order? :)",
"email_body__multiline_required": "Hello,\n\nThanks for ordering from {{ shop.name }}!\n\nYour item{% if order.line_items.size > 1 %}s{% endif %} arrived a week ago, and we have a quick question: <b>will you review your purchase?</b>\n\nHere {% if order.line_items.size > 1 %}are direct links{% else %}is a direct link{% endif %}, to make this easy for you:\n<ul>{% for line_item in order.line_items %}{% if line_item.product_exists or event.preview %}<li><a href=\"https://{{ shop.domain }}/products/{{ line_item.product.handle }}\">{{ line_item.name }}</a></li>{% endif %}{% endfor %}</ul>\nThanks so much!\n\nSincerely,\nThe team at {{ shop.name }}"
},
"order_status_javascript": null,
"perform_action_runs_in_sequence": false,
"script": "{% comment %}\n Option order:\n {{ options.days_to_wait_before_emailing__number_required }}\n {{ options.only_send_to_customers_who_have_accepted_marketing__boolean }}\n {{ options.customer_tag_to_add_after_sending }}\n {{ options.ignore_customers_having_this_tag }}\n {{ options.ignore_orders_having_this_tag }}\n {{ options.email_subject__required }}\n {{ options.email_body__multiline_required }}\n{% endcomment %}\n\n{% assign send_email = true %}\n{% assign order = order.reload %}\n\n{% if event.preview %}\n {% capture order_json %}\n {\n \"line_items\": [\n {\n \"product_exists\": true\n }\n ],\n \"email\": \"[email protected]\",\n \"tags\": \"\",\n \"customer\": {\n \"admin_graphql_api_id\": \"gid://shopify/Customer/1234567890\",\n \"tags\": \"\",\n \"email_marketing_consent\": {\n \"state\": \"subscribed\"\n }\n }\n }\n {% endcapture %}\n\n {% assign order = order_json | parse_json %}\n{% endif %}\n\n{% assign has_product = false %}\n{% for line_item in order.line_items %}\n {% if line_item.product_exists %}\n {% assign has_product = true %}\n {% break %}\n {% endif %}\n{% endfor %}\n\n{% if has_product != true %}\n {% log \"Order has no products; skipping\" %}\n {% assign send_email = false %}\n{% endif %}\n\n{% if order.email == blank %}\n {% assign send_email = false %}\n {% log \"Order has no email on file; skipping\" %}\n{% endif %}\n\n{% if options.ignore_orders_having_this_tag != blank %}\n {% assign order_tags = order.tags | split: \", \" %}\n\n {% if order_tags contains options.ignore_orders_having_this_tag %}\n {% log message: \"Order is currently tagged with the tag to ignore\", tag: options.ignore_orders_having_this_tag %}\n {% assign send_email = false %}\n {% endif %}\n{% endif %}\n\n{% if order.customer and options.ignore_customers_having_this_tag != blank %}\n {% assign customer_tags = order.customer.tags | split: \", \" %}\n\n {% if customer_tags contains options.ignore_customers_having_this_tag %}\n {% log message: \"Customer is currently tagged with the tag to ignore\", tag: options.ignore_customers_having_this_tag %}\n {% assign send_email = false %}\n {% endif %}\n{% endif %}\n\n{% if options.only_send_to_customers_who_have_accepted_marketing__boolean %}\n {% if order.customer.email_marketing_consent.state != \"subscribed\" %}\n {% log \"This customer does not accept marketing.\" %}\n {% assign send_email = false %}\n {% endif %}\n{% endif %}\n\n{% if send_email %}\n {% action \"email\" %}\n {\n \"to\": {{ order.email | json }},\n \"subject\": {{ options.email_subject__required | json }},\n \"body\": {{ options.email_body__multiline_required | strip | newline_to_br | json }},\n \"reply_to\": {{ shop.customer_email | json }},\n \"from_display_name\": {{ shop.name | json }}\n }\n {% endaction %}\n\n {% if order.customer and options.customer_tag_to_add_after_sending != blank %}\n {% action \"shopify\" %}\n mutation {\n tagsAdd(\n id: {{ order.customer.admin_graphql_api_id | json }}\n tags: {{ options.customer_tag_to_add_after_sending | json }}\n ) {\n userErrors {\n field\n message\n }\n }\n }\n {% endaction %}\n {% endif %}\n{% endif %}\n",
"subscriptions": [
"shopify/orders/fulfilled+7.days"
],
"subscriptions_template": "shopify/orders/fulfilled+{{ options.days_to_wait_before_emailing__number_required | default: 7 }}.days",
"tags": [
"Email",
"Fulfillment",
"Orders",
"Reviews"
]
}