Auto-add phone numbers to unfulfilled orders, when the customer is updated, with Mechanic.

Mechanic is a development platform for Shopify. :)

Auto-add phone numbers to unfulfilled orders, when the customer is updated

When a customer update occurs, if the customer has a phone number on file, this task will look for unshipped or partially shipped orders that don't yet have a phone number on file, and will add the customer's phone number to those orders.

Runs when a customer is updated.

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.

Open source
View on GitHub to contribute to this task
Events
when a customer is updated (shopify/customers/update)
Script
{% if event.preview %}
  {% action "shopify" %}
    [
      "update",
      ["order", {{ order.id | json }}],
      {"phone": {{ customer.phone | json }}}
    ]
  {% endaction %}
{% elsif customer.phone != blank %}
  {% assign orders = customer.orders.any.unshipped | concat: customer.orders.any.partial %}

  {% for order in orders %}
    {% if order.phone != blank %}
      {% continue %}
    {% endif %}

    {% action "shopify" %}
      [
        "update",
        ["order", {{ order.id | json }}],
        {"phone": {{ customer.phone | json }}}
      ]
    {% endaction %}
  {% endfor %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.