Auto-prefix tracking numbers for each new fulfillment, with Mechanic.

Mechanic is a development platform for Shopify. :)

Auto-prefix tracking numbers for each new fulfillment

This task runs immediately after each new fulfillment is created, and adds a prefix to its tracking number, if a tracking number is present.

Runs when a fulfillment is created. Configuration includes tracking number prefix to add and notify customer.

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
when a fulfillment is created (shopify/fulfillments/create)
tracking number prefix to add (required), notify customer (boolean)
{% if event.preview %}
  {% assign fulfillment = hash %}
  {% assign fulfillment["tracking_number"] = "1234567890" %}
  {% assign fulfillment["admin_graphql_api_id"] = "gid://shopify/Fulfillment/1234567890" %}
{% endif %}

{% if fulfillment.tracking_number == blank %}
  {"log": "This fullfilment has no tracking number; can't add a prefix"}
{% else %}
  {% action "shopify" %}
    mutation {
        fulfillmentId: {{ fulfillment.admin_graphql_api_id | json }}
        trackingInfoUpdateInput: {
          trackingDetails: {
            number: {{ fulfillment.tracking_number | prepend: options.tracking_number_prefix_to_add__required | json }}
          notifyCustomer: {{ options.notify_customer__boolean | json }}
      ) {
        fulfillment {
          trackingInfo {
        userErrors {
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.