For the complete documentation index, see llms.txt. This page is also available as Markdown.

GraphQL

Use Shopify's GraphQL Admin API in Mechanic Shopify automation tasks to read and write store data — orders, products, customers, metafields, and more.

Mechanic tasks have direct inline access to Shopify's GraphQL Admin API. Run queries during task execution to read data, and use GraphQL mutations via the Shopify action to write data — giving you the same level of API access you'd have in a custom app, without the infrastructure.

Reading data with GraphQL

Use the shopify Liquid filter to run a GraphQL query inline during a task run. The result is available immediately.

{% capture query %}
  query {
    orders(first: 5, query: "financial_status:paid") {
      nodes {
        id
        name
        totalPriceSet {
          shopMoney {
            amount
          }
        }
      }
    }
  }
{% endcapture %}

{% assign result = query | shopify %}

{% for order in result.data.orders.nodes %}
  {{ order.name }}: {{ order.totalPriceSet.shopMoney.amount }}
{% endfor %}

Learn more: Queries

Writing data with GraphQL

Use the Shopify action to run GraphQL mutations. Mutations are queued during the task run and performed after the task code finishes.

Learn more: Mutations

Learn more

Last updated

Was this helpful?