Report Toaster: Pirate Ship Integration, with Mechanic.

Mechanic is a development and ecommerce automation platform for Shopify. :)

Report Toaster: Pirate Ship Integration

Email Pirate Ship exports to Mechanic and add those shipping costs to orders with Report Toaster.

Runs Occurs when your Mechanic account receives an email. Configuration includes email subject, order name column, prepend pound sign to order name, and shipping cost column.

15-day free trial – unlimited tasks

Documentation

Email Pirate Ship exports to Mechanic and add those shipping costs to orders with Report Toaster.

Did you know your store has its very own email address for triggering Mechanic tasks? A store at example.myshopify.com can receive email at example@mail.usemechanic.com.

One or more attachments can be sent and will be processed as long as they meet the following requirements:

  1. The email subject must match the email subject set in the task options.
  2. The CSV attachment format matches the order and shipping column names set in the task options.
  3. If the order name data does not include the # sign and your shop does, use the prepend pound sign to order name option.

Each attachment will be parsed and sent to Report Toaster.

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, 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.

(By the way, have you seen our documentation? Have you joined the Slack community?)

Open source
View on GitHub to contribute to this task
Subscriptions
mechanic/emails/received
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
email subject (required), order name column (required), prepend pound sign to order name (boolean), shipping cost column (required)
Code
{% comment %}
  An opinion about option order
  {{ options.email_subject__required }}
  {{ options.order_name_column__required }}
  {{ options.prepend_pound_sign_to_order_name__boolean }}
  {{ options.shipping_cost_column__required }}
{% endcomment %}

{% assign updates = array %}

{% if event.preview %}
  {% assign update = hash %}
  {% assign update["name"] = "#1234" %}
  {% assign update["shipping_cost"] = 1.23 %}
  {% assign updates[updates.size] = update %}
  {% assign email = hash %}
  {% assign email["subject"] = options.email_subject__required %}
{% endif %}

{% if email.subject == options.email_subject__required %}
  {% for attachment in email.attachments %}
    {% assign shipments = attachment.content | decode_base64 | parse_csv: headers: true %}
      {% for shipment in shipments %}
        {% assign order_name = shipment[options.order_name_column__required] %}
        {% assign shipping_cost = shipment[options.shipping_cost_column__required] %}

        {% if order_name != blank %}
          {% if options.prepend_pound_sign_to_order_name__boolean %}
            {% assign order_name = order_name | prepend: "#" %}
          {% endif %}
          {% assign update = hash %}
          {% assign update["name"] = order_name %}
          {% assign update["shipping_cost"] = shipping_cost %}  
          {% assign updates[updates.size] = update %}
        {% endif %}

      {% endfor %}
  {% endfor %}
{% endif %}

{% if updates != empty %}
  {% action "report_toaster" %}
    {
      "operation": "update",
      "Order": {{ updates | json }}
    }
  {% endaction %}
{% endif %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more
Defaults
Email subject
Shipping Costs
Order name column
Order ID
Prepend pound sign to order name
true
Shipping cost column
Cost