Mechanic Get Mechanic
Task library

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.

Try this task

When it runs

Occurs whenever a fulfillment is created

What you choose

Default tracking number

Task code and subscriptions

You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.

Subscriptions

shopify/fulfillments/create
How task subscriptions work

Option types and flags

Task 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 %}
Mechanic Liquid reference