Mechanic is a development and ecommerce automation platform for Shopify. :)
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 Occurs whenever a fulfillment is created. Configuration includes tracking number prefix to add and notify customer.
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?)
shopify/fulfillments/create
{% 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 { fulfillmentTrackingInfoUpdate( 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 { number } } userErrors { field message } } } {% endaction %} {% endif %}