githubEdit

Task editor

Create, edit, and test Mechanic tasks — configure options in Basic mode or write Liquid code in Advanced mode.

The task editor is where you configure and write Mechanic tasks. It has two modes: Basic for adjusting a task's settings, and Advanced for editing code, testing with preview events, and managing runtime behavior.

Switch between modes using the Advanced/Basic mode toggle in the page actions menu. You can set your default in Settings.

circle-info

If you're using tasks from the task library and only need to adjust their settings, Basic mode is all you need. Advanced mode is for writing or editing task code.

Basic mode

The task editor in Basic mode, showing options and documentation

Basic mode displays the task's settings and documentation, with no code visible. Use it to configure a task's options — the fields that control how the task behaves (e.g., which tag to apply, which email to send to).

Advanced mode

The task editor in Advanced mode, showing the code tab with subscriptions, Liquid editor, options sidebar, and preview

Advanced mode provides a tabbed editor with a sidebar showing Options and a live Preview of the actions your task will perform based on your code.

Code tab

The main editing surface:

  • Subscriptions — the Shopify events (like order creation or fulfillment) that trigger this task, one per line. Supports offsets for delays (e.g., shopify/orders/create+1.hour).

  • Code — the task's Liquid code, written in Mechanic's implementation of the Liquid language (related to but distinct from Shopify theme Liquid)

Preview events tab

Create test events to see how your task will behave without affecting real data. You can define multiple preview events per topic to test different scenarios, label them with descriptions, and use stub data (hardcoded sample data that stands in for real API responses) to mock Shopify API responses. The task preview updates automatically as you edit, showing generated actions, errors, and any Shopify permission changes.

JavaScript tab

Add JavaScript that runs in your customers' browser on the online storefront or order status page. Most tasks don't use this — it's for tasks that need client-side interactivity.

Runtime tab

  • Shopify Admin API version — which API version the task uses

  • Perform action runs in sequence — by default, Mechanic runs all of a task's actions in parallel. Enable this to run them one at a time, which is useful when later actions depend on earlier ones.

  • Halt the sequence when one fails — stop processing remaining actions if one fails

Permissions tab

A read-only view of the Shopify API permissions your task requires. Mechanic scans your code and preview events to determine these automatically — you don't need to manage them manually.

Docs & Tags tab

Add tags to organize your task, and write Markdown documentation with a live preview.

Page actions

The actions menu in the page header includes:

  • Events — view all events processed by this task

  • Import / Export — paste a JSON task export, or copy this task as JSON. Learn more in Import and export.

  • Duplicate — create a copy of the task

  • Versions — view and restore previous versions of the task

Running a task

If your task subscribes to mechanic/user/trigger, mechanic/user/text, or mechanic/user/form, a Run task button appears in the page header.

  • Trigger tasks run immediately with one click

  • Text tasks prompt for a text input

  • Form tasks show a form with fields defined by the task's user form options

Last updated

Was this helpful?