Mechanic is a development platform for Shopify. :)
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 billing or shipping address (whichever is available), upon their first purchase.
Runs when an order is created.
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.
{% 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 %} {% assign first_name = order.billing_address.first_name %} {% assign last_name = order.billing_address.last_name %} {% if first_name == blank and last_name == blank %} {% assign first_name = order.shipping_address.first_name %} {% assign last_name = order.shipping_address.last_name %} {% endif %} { "action": { "type": "shopify", "options": [ "update", ["customer", {{ order.customer.id | json }}], { "first_name": {{ first_name | json }}, "last_name": {{ last_name | json }} } ] } } {% endif %}