Liquid objects
Last updated
Was this helpful?
Last updated
Was this helpful?
Mechanic-flavored Liquid comes with a complement of , each of which is tied to a resource in the . Many objects support access to related objects via lookups (e.g. {{ shop.customers[customer_id].orders.first }}
); in this way, the REST API can be traversed by resource.
Shopify is deprecating some of the Shopify Admin REST API. The first round of deprecations involve the product and variant endpoints. Read the deprecation notice .
Our recommendation is to use going forward. The and objects will cease to work on on Feb 1, 2025 due to the changes being made by Shopify. It appears that Shopify will gradually phase out the REST API over time.
All of our will be ported to use GraphQL only, which will provide a model for how you can update your custom tasks. You'll be able to update your non-customized library tasks with a click of a button
Access to these Liquid objects varies, based on the context in which Liquid is rendered. For example, a task that subscribes to shopify/customers/create will have access to the object in its code, via a variable called customer
. To learn more about how these objects are made available to task code, see .
Shopify variables in Mechanic do not necessarily contain the same attributes as Liquid variables used in Shopify (in places like themes or email templates) β even if they share the same name.
In Mechanic, Shopify variables always contain data from Shopify events, which are delivered to Mechanic via webhook. This means that Shopify variables always have the same data structure as Shopify webhooks, corresponding to Shopify's REST representation for this data.
For example, while Shopify themes support {{ customer.name }}
, Mechanic does not (because does not contain a "name" property). On the other hand, Mechanic supports {{ customer.created_at }}
, while Shopify themes do not.
Each task is given a set of to work with, out of the box. Mechanic's task code editor will tell you which ones are available. For example, for a task responding to a shopify/orders/
event, you might see this:
The , , , and objects are always available for tasks; the object (as in this example) contains the order to which the current event relates.