-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto-tag-new-orders-using-liquid.json
20 lines (20 loc) · 1.6 KB
/
auto-tag-new-orders-using-liquid.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"docs": "This task offers an introduction to using Liquid to dynamically update your orders. This task comes with example Liquid code, showing you how to tag an order as \"even\" or \"odd\", based on whether the order number is even or odd; replace this Liquid with whatever suits your purposes. :)",
"halt_action_run_sequence_on_error": false,
"name": "Auto-tag new orders using Liquid",
"online_store_javascript": null,
"options": {
"order_tag_value__code_multiline_required": "{% comment %}\n This is an example! It calculates whether or not the order number\n is even, and tags the order accordingly.\n{% endcomment %}\n\n{% assign mod = order.number | modulo: 2 %}\n\n{% if mod == 0 %}\n even\n{% else %}\n odd\n{% endif %}"
},
"order_status_javascript": null,
"perform_action_runs_in_sequence": false,
"script": "{% if event.preview %}\n {% assign order = hash %}\n {% assign order[\"admin_graphql_api_id\"] = \"gid://shopify/Order/1234567809\" %}\n{% endif %}\n\n{% unless options.order_tag_value__code_multiline_required == blank %}\n {% action \"shopify\" %}\n mutation {\n tagsAdd(\n id: {{ order.admin_graphql_api_id | json }}\n tags: {{ options.order_tag_value__code_multiline_required | strip | json }}\n ) {\n node {\n ... on Order{\n tags\n }\n }\n userErrors{\n field\n message\n }\n }\n }\n {% endaction %}\n{% endunless %}",
"subscriptions": [
"shopify/orders/create"
],
"subscriptions_template": "shopify/orders/create",
"tags": [
"Auto-Tag",
"Orders"
]
}