Auto-tag new customers with the current date, with Mechanic.

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

Auto-tag new customers with the current date

Use this task to tag incoming customers with the current date/time, using the format of your choice, and optionally a prefix and suffix. If you like, enable "Wait until the customer is enabled" to apply the tag when the customer's online account is activated, rather than when the customer is first created.

Runs Occurs whenever a customer is created and Occurs whenever a customer is created. Configuration includes tag date format, tag prefix, tag suffix, and wait until the customer is enabled.

15-day free trial – unlimited tasks

Documentation

Use this task to tag incoming customers with the current date/time, using the format of your choice, and optionally a prefix and suffix. If you like, enable "Wait until the customer is enabled" to apply the tag when the customer's online account is activated, rather than when the customer is first created.

To customize the date/time format, use an "strftime" reference, like www.strfti.me.

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
{% if options.wait_until_the_customer_is_enabled__boolean %}
  shopify/customers/enable
{% else %}
  shopify/customers/create
{% endif %}
shopify/customers/create
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
tag date format (required), tag prefix, tag suffix, wait until the customer is enabled (boolean)
Code
{% assign tag = "now" | date: options.tag_date_format__required | prepend: options.tag_prefix | append: options.tag_suffix %}

{% if event.preview %}
  {% assign customer = hash %}
  {% assign customer["admin_graphql_api_id"] = "gid://shopify/Customer/12345" %}
{% endif %}

{% action "shopify" %}
  mutation {
    tagsAdd(
      id: {{ customer.admin_graphql_api_id | json }}
      tags: {{ tag | json }}
    ) {
      userErrors {
        field
        message
      }
    }
  }
{% endaction %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more
Defaults
Tag date format
%Y%m%d
Tag prefix
signup-