Mechanic is a development and ecommerce automation platform for Shopify. :)
This task will watch for new order fulfillments, waiting a configurable number of days after each one. When the waiting period is over, if the fulfillment's status matches an item in the list, this task will send an event to Klaviyo, allowing you to use Klaviyo to contact the customer appropriately.
Runs Occurs whenever an order is fulfilled, with a 5 day delay. Configuration includes test mode, qualifying fulfillment statuses, klaviyo api token, klaviyo event name, and days to wait before checking.
This task will watch for new order fulfillments, waiting a configurable number of days after each one. When the waiting period is over, if the fulfillment's status matches an item in the list, this task will send an event to Klaviyo, allowing you to use Klaviyo to contact the customer appropriately.
Configure the "Qualifying fulfillment statuses" option with values from Shopify's "shipment_status" documentation.
Enable "Test mode" to make available a "Run task" button - press this button to have Mechanic send a test event to Klaviyo, allowing you to verify that everything's connected properly.
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?)
{% if options.test_mode__boolean %} mechanic/user/trigger {% else %} shopify/orders/fulfilled+{{ options.days_to_wait_before_checking__number_required | default: 5 }}.days {% endif %}
{% if options.test_mode__boolean or event.preview %} {% capture order_json %} { "name": "#1234", "email": "customer@example.com", "fulfillments": [ { "shipment_status": {{ options.qualifying_fulfillment_statuses__array_required[0] | json }} } ] } {% endcapture %} {% assign order = order_json | parse_json %} {% else %} {% assign order = order.reload %} {% endif %} {% assign fulfillments_qualify = false %} {% for fulfillment in order.fulfillments %} {% if options.qualifying_fulfillment_statuses__array_required contains fulfillment.shipment_status %} {% assign fulfillments_qualify = true %} {% endif %} {% endfor %} {% if fulfillments_qualify %} {% assign klaviyo_data = hash %} {% assign klaviyo_data["token"] = options.klaviyo_api_token__required %} {% assign klaviyo_data["event"] = options.klaviyo_event_name__required %} {% assign klaviyo_data["customer_properties"] = hash %} {% assign klaviyo_data["customer_properties"]["$email"] = order.email %} {% assign klaviyo_data["properties"] = hash %} {% assign klaviyo_data["properties"]["order_name"] = order.name %} {% action "http" %} { "method": "get", "url": "https://a.klaviyo.com/api/track?data={{ klaviyo_data | json | base64 }}" } {% endaction %} {% endif %}
["in_transit", "failure", "attempted_delivery"]
Fulfillment delayed or failed
5