Set a default tracking number for new fulfillments, with Mechanic.

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

Set a default tracking number for new fulfillments

This task is here to illustrate managing tracking numbers. If a default tracking number is right for your orders, you can use this task to make sure that one is added the instant a fulfillment is created.

Runs Occurs whenever a fulfillment is created. Configuration includes default tracking number.

15-day free trial – unlimited tasks

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
shopify/fulfillments/create
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
default tracking number (required)
Code
{% if event.preview or fulfillment.tracking_number == blank %}
  {
    "action": {
      "type": "shopify",
      "options": [
        "update",
        [
          "order",
          {{ fulfillment.order_id | json }},
          "fulfillment",
          {{ fulfillment.id | json }}
        ],
        {
          "tracking_number": {{ options.default_tracking_number__required | json }}
        }
      ]
    }
  }
{% endif %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more