Reading and Writing to Shopify
How Mechanic Shopify automation tasks read and write store data — inline GraphQL queries for reads, and Shopify actions for mutations.
Last updated
Was this helpful?
How Mechanic Shopify automation tasks read and write store data — inline GraphQL queries for reads, and Shopify actions for mutations.
Mechanic tasks have full access to the Shopify Admin API. Tasks can read data inline during execution — running GraphQL queries to fetch additional context beyond the triggering event — and write data via actions that run Shopify GraphQL mutations after the task completes. This gives tasks the same level of API access available to custom apps, without requiring you to build or host app infrastructure.
Use the shopify Liquid filter to query Shopify data inline during a task run. This filter accepts a GraphQL query and returns the result immediately.
{% capture query %}
query {
product(id: "gid://shopify/Product/1234567890") {
title
status
}
}
{% endcapture %}
{% assign result = query | shopify %}
{{ result.data.product.title }}Learn more: Reading data
Use the Shopify action to create, update, or delete Shopify resources. Shopify actions are queued during the task run and performed after the task code finishes, so you cannot use the result of a mutation in the same task run that creates it.
Learn more: Writing data
Use bulk operations when Shopify should process a large read or write asynchronously. Bulk operation queries read large datasets into JSONL results; bulk operation mutations run the same mutation many times using a staged JSONL variables file.
Shopify REST is deprecated in Mechanic. Use the GraphQL Admin API for all new tasks. See Converting tasks from Shopify REST to GraphQL for migration guidance.
Mechanic can respond to Shopify webhooks (like shopify/orders/create or shopify/products/update) by subscribing tasks to the corresponding event topics.
Learn more: Responding to events
API rate limit — how Mechanic manages Shopify's rate limits
API versions — how tasks select a Shopify API version
Bulk operations — asynchronous Shopify reads and writes
Last updated
Was this helpful?
Was this helpful?
{% action "shopify" %}
mutation {
productUpdate(input: { id: "gid://shopify/Product/1234567890", title: "New Title" }) {
product {
title
}
userErrors {
field
message
}
}
}
{% endaction %}