Useful for making queries reusable within a task, or for working around Shopify's 50,000 character limit for GraphQL query strings, Mechanic's shopify Liquid filter now accepts an optional argument for providing GraphQL variables:
{% capture query %}
query ProductQuery($id: ID!) {
product(id: $id) {
title
}
}
{% endcapture %}
{% assign variables = hash %}
{% assign variables["id"] = product_id %}
{% assign result = query | shopify: variables: variables %}
{% log result %}
This complements Mechanic's pre-existing support for GraphQL variables in the Shopify action.
Read more