Auto-copy notes from customers to their orders with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Auto-copy notes from customers to their orders

by Isaac Bowen (team@usemechanic.com)

Save time jumping between screens, by making sure that the order record has everything you need. Useful for shops that keep important fulfillment information in the customer notes. This task can be run manually to back-fill notes for open orders.

Runs when an order is created and when a user triggers the task.

15-day free trial – unlimited tasks

Documentation

This task runs automatically, whenever a new order is created.

Run this task manually to scan all open orders, copying the customer note to the order note. (To include open orders older than 60 days, enable "read all orders".)

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 created (shopify/orders/create)
when a user triggers the task (mechanic/user/trigger)
Script
{% capture newline %}
{% endcapture %}

{% if event.preview %}
  {
    "action": {
      "type": "shopify",
      "options": [
        "update",
        [
          "order",
          12345
        ],
        {
          "note": "(Note copied from customer)"
        }
      ]
    }
  }
{% elsif event.topic == "shopify/orders/create" %}
  {% if order.customer.note == blank %}
    {"log": "No note on file for this customer; skipping order update"}
  {% else %}
    {
      "action": {
        "type": "shopify",
        "options": [
          "update",
          [
            "order",
            {{ order.id | json }}
          ],
          {
            "note": {{ order.note | append: newline | append: newline | append: order.customer.note | strip | json }}
          }
        ]
      }
    }
  {% endif %}
{% elsif event.topic == "mechanic/user/trigger" %}
  {% for order in shop.orders.open %}
    {% assign order_note_downcased = order.note | downcase %}
    {% assign customer_note_downcased = order.customer.note | downcase %}

    {% unless customer_note_downcased == blank or order_note_downcased contains customer_note_downcased %}
      {
        "action": {
          "type": "shopify",
          "options": [
            "update",
            [
              "order",
              {{ order.id | json }}
            ],
            {
              "note": {{ order.note | append: newline | append: newline | append: order.customer.note | strip | json }}
            }
          ]
        }
      }
    {% endunless %}
  {% endfor %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.