Email someone when a certain product is purchased, with Mechanic.

Mechanic is an automation development platform for Shopify. :)

Email someone when a certain product is purchased

by Ken Parelius (team@usemechanic.com)

The task allows you to send an email to an address (or addresses) of your choice when a certain product is purchased.

Runs when an order is paid. Configuration includes email address, email subject, email body, reply to email address, and product title.

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
when an order is paid (shopify/orders/paid)
Options
email address (required), email subject (required), email body (multiline, required), reply to email address, product title (required)
Script
{% capture email_action %}
  {
    "action": {
      "type": "email",
      "options": {
        "to": {{ options.email_address__required | json }},
        "subject": {{ options.email_subject__required | json }},
        "body": {{ options.email_body__multiline_required | strip | newline_to_br | json }},
        "reply_to": {{ options.reply_to_email_address | json }},
        "from_display_name": {{ shop.name | json }}
      }
    }
  }
{% endcapture %}

{% if event.preview %}
  {{ email_action }}
{% else %}
  {% for line_item in order.line_items %}
    {% if line_item.title == options.product_title__required %}
      {{ email_action }}
      {% break %}
    {% endif %}
  {% endfor %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.