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

Mechanic is a development platform for Shopify. :)

Email someone when a certain product is purchased

by Ken Parelius and Isaac Bowen (team@usemechanic.com)

This task sends an email notification, immediately after an order is paid - if a product in the order has a title matching the product title you configure. Optionally, configure this task with a delay, in days, to wait before sending the email.

Runs when an order is paid. Configuration includes product title, email address, email subject, email body, reply to email address, and number of days to wait before emailing.

15-day free trial – unlimited tasks

Documentation

This task sends an email notification, immediately after an order is paid - if a product in the order has a title matching the product title you configure. Optionally, configure this task with a delay, in days, to wait before sending the email. (The task will not send any emails for orders that have since been cancelled.)

YouTube: See the upgrade process for this task!

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
product title (required), email address (required), email subject (required), email body (multiline, required), reply to email address, number of days to wait before emailing (number)
Script
{% unless event.preview %}
  {% assign order = order.reload %}
{% endunless %}

{% assign order_qualifies = false %}

{% for line_item in order.line_items %}
  {% if line_item.product.title == options.product_title__required %}
    {% assign order_qualifies = true %}
    {% break %}
  {% endif %}
{% endfor %}

{% if order.cancelled_at != blank %}
  {% assign order_qualifies = false %}
{% endif %}

{% if event.preview or order_qualifies %}
  {% action "email" %}
    {
      "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 }}
    }
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.