Ask for reviews a week after order fulfillment, with Mechanic.

Mechanic is a development platform for Shopify. :)

Ask for reviews a week after order fulfillment

by Isaac Bowen (team@usemechanic.com)

Follow up with your customers automatically, and establish the purchase -> earn-reviews -> attract-customers cycle. This task comes prefilled with a friendly email that gives the customer direct links to their purchases on your website – customize this email to taste.

Runs 7 days after an order is fulfilled. Configuration includes days to wait before emailing, only send to customers who have accepted marketing, customer tag to add after sending, ignore customers having this tag, ignore orders having this tag, email subject, and email body.

15-day free trial – unlimited tasks

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

Events
7 days after an order is fulfilled (shopify/orders/fulfilled+7.days)
Options
days to wait before emailing (number, required), only send to customers who have accepted marketing (boolean), customer tag to add after sending, ignore customers having this tag, ignore orders having this tag, email subject (required), email body (multiline, required)
Script
{% comment %}
  Option order:
  {{ options.days_to_wait_before_emailing__number_required }}
  {{ options.only_send_to_customers_who_have_accepted_marketing__boolean }}
  {{ options.customer_tag_to_add_after_sending }}
  {{ options.ignore_customers_having_this_tag }}
  {{ options.ignore_orders_having_this_tag }}
  {{ options.email_subject__required }}
  {{ options.email_body__multiline_required }}
{% endcomment %}

{% assign send_email = true %}
{% assign order = order.reload %}

{% if event.preview %}
  {% capture order_json %}
    {
      "line_items": [
        {
          "product_exists": true
        }
      ],
      "email": "customer@example.com",
      "tags": "",
      "customer": {
        "admin_graphql_api_id": "gid://shopify/Customer/1234567890",
        "tags": "",
        "accepts_marketing": true
      }
    }
  {% endcapture %}

  {% assign order = order_json | parse_json %}
{% endif %}

{% assign has_product = false %}
{% for line_item in order.line_items %}
  {% if line_item.product_exists %}
    {% assign has_product = true %}
    {% break %}
  {% endif %}
{% endfor %}

{% if has_product != true %}
  {% log "Order has no products; skipping" %}
  {% assign send_email = false %}
{% endif %}

{% if order.email == blank %}
  {% assign send_email = false %}
  {% log "Order has no email on file; skipping" %}
{% endif %}

{% if options.ignore_orders_having_this_tag != blank %}
  {% assign order_tags = order.tags | split: ", " %}

  {% if order_tags contains options.ignore_orders_having_this_tag %}
    {% log message: "Order is currently tagged with the tag to ignore", tag: options.ignore_orders_having_this_tag %}
    {% assign send_email = false %}
  {% endif %}
{% endif %}

{% if order.customer and options.ignore_customers_having_this_tag != blank %}
  {% assign customer_tags = order.customer.tags | split: ", " %}

  {% if customer_tags contains options.ignore_customers_having_this_tag %}
    {% log message: "Customer is currently tagged with the tag to ignore", tag: options.ignore_customers_having_this_tag %}
    {% assign send_email = false %}
  {% endif %}
{% endif %}

{% if options.only_send_to_customers_who_have_accepted_marketing__boolean %}
  {% if order.customer.accepts_marketing != true %}
    {% log "This customer does not accept marketing." %}
    {% assign send_email = false %}
  {% endif %}
{% endif %}

{% if send_email %}
  {% action "email" %}
    {
      "to": {{ order.email | json }},
      "subject": {{ options.email_subject__required | json }},
      "body": {{ options.email_body__multiline_required | strip | json }},
      "reply_to": {{ shop.customer_email | json }},
      "from_display_name": {{ shop.name | json }}
    }
  {% endaction %}

  {% if order.customer and options.customer_tag_to_add_after_sending != blank %}
    {% action "shopify" %}
      mutation {
        tagsAdd(
          id: {{ order.customer.admin_graphql_api_id | json }}
          tags: {{ options.customer_tag_to_add_after_sending | json }}
        ) {
          userErrors {
            field
            message
          }
        }
      }
    {% endaction %}
  {% endif %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Days to wait before emailing
7
Only send to customers who have accepted marketing
true
Email subject
Will you review your order? :)
Email body
Hello,

Thanks for ordering from {{ shop.name }}!

Your 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>

Here {% if order.line_items.size > 1 %}are direct links{% else %}is a direct link{% endif %}, to make this easy for you:
<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>
Thanks so much!

Sincerely,
The team at {{ shop.name }}