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
  • Notify customer

Documentation

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.

Optionally, you can notify the customer when the tracking number is set.

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 "shopify" %}
    mutation {
      fulfillmentTrackingInfoUpdate(
        fulfillmentId: {{ fulfillment.admin_graphql_api_id | json }}
        trackingInfoInput: {
          number: {{ options.default_tracking_number__required | json }}
        }
        notifyCustomer: {{ options.notify_customer__boolean | json }}
      ) {
        fulfillment {
          id
          trackingInfo {
            number
            url
          }
        }
        userErrors {
          field
          message
        }
      }
    }
  {% endaction %}
{% endif %}
Mechanic Liquid reference

Default option values

Notify customer
false