Bulk capture orders by order number
The merchant who created this task uses another app for validating orders in bulk, resulting in a list of order numbers that should be captured. This task prompts the merchant for a list of order numbers, which Mechanic then captures one by one.
Try this taskWhen it runs
Occurs when a user manually triggers the task with text
Task code and subscriptions
You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.
Subscriptions
mechanic/user/text
How task subscriptions work
Task code
{% capture newline %}
{% endcapture %}
{% assign order_numbers = event.data | split: newline %}
{% for authorized_order in shop.orders.authorized %}
{% capture order_number_string %}{{ authorized_order.order_number }}{% endcapture %}
{% if order_numbers contains order_number_string %}
{
"action": {
"type": "shopify",
"options": [
"post",
"/admin/orders/{{ authorized_order.id }}/transactions.json",
{ "transaction": { "kind": "capture" } }
]
}
}
{% endif %}
{% endfor %}
Mechanic Liquid reference