Set a default tracking number for new fulfillments with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Set a default tracking number for new fulfillments

by Isaac Bowen (team@usemechanic.com)

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 when 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, 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.

Events
when a fulfillment is created (shopify/fulfillments/create)
Options
default tracking number (required)
Script
{% 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 tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.