Backfill customer names from order shipping addresses with Mechanic.

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

Backfill customer names from order shipping addresses

by Isaac Bowen (team@usemechanic.com)

The merchant who requested this task removed the first- and last-name fields from their storefront's registration form, to speed up the customer signup process. This task fills in those blanks by copying the customer's name from the shipping address, upon their first purchase.

Runs when an order is created.

15-day free trial – unlimited tasks

Developer details

Events
when an order is created (shopify/orders/create)
Options
Script
{% if event.preview %}
  {
    "action": {
      "type": "shopify",
      "options": [
        "update",
        ["customer", 12345],
        {
          "first_name": "Jane",
          "last_name": "Doe"
        }
      ]
    }
  }
{% elsif order.customer.first_name == blank and order.customer.last_name == blank %}
  {
    "action": {
      "type": "shopify",
      "options": [
        "update",
        ["customer", {{ order.customer.id | json }}],
        {
          "first_name": {{ order.shipping_address.first_name | json }},
          "last_name": {{ order.shipping_address.last_name | json }}
        }
      ]
    }
  }
{% endif %}
Yep, that’s just Liquid! If this is interesting to you, check out our documentation! Mechanic is hugely developer-friendly. :)