Environment variables
A task's Liquid code always has access to a set of environment variables, defined by Mechanic.
shop
An object containing Shopify's REST representation of the current Shopify store
event
An object containing information about the current event
cache
The current store's Mechanic cache object, supporting lookups for cached values
globals
The current store's visible globals, for reusable JSON configuration
secrets
The current store's write-only secrets, returned as opaque references unless used by a supported action or signing filter
task
An object containing information about the current task
options
An object containing task options, configured by the user
Event subject variables
When a task is actually invoked for an event, it may have access to an additional variable, determined by the specific event it is responding to. When this is the case, the additional variable will be named after the event subject, and its contents will be established by the event's data. The name of this variable is communicated by the Mechanic task editor, based on the task's current subscriptions.
For example, a subscription to shopify/customers/create will make available a variable called customer. A subscription to shopify/products/update will expose a variable called product, etc.
Shopify variables
All Shopify events support an additional variable named after the event topic. For example, when a task responds to a shopify/customers/create event, it will have access to an additional variable named customer, containing the customer data contained in the event.
Shopify events always contain data from Shopify's REST representation of each resource; therefore, automatic Shopify variables always contain data from the REST representation as well. The best resource for the data available for each variable type is Shopify's REST Admin API reference.
Last updated
Was this helpful?