β οΈLiquid objects
Last updated
Last updated
Important Updates
π£ Shopify REST DeprecationMechanic-flavored Liquid comes with a complement of Liquid objects, each of which is tied to a resource in the Shopify Admin REST API. 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 here.
Our recommendation is to use GraphQL going forward. The product and variant 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 library tasks 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 Customer object in its code, via a variable called customer
. To learn more about how these objects are made available to task code, see environment variables.
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 Shopify's REST representation of the customer resource 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 environment variables 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 cache, event, options, and shop objects are always available for tasks; the order object (as in this example) contains the order to which the current event relates.