Bulk capture orders by order number, with Mechanic.

Mechanic is a development and ecommerce automation platform for Shopify. :)

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.

Runs Occurs when a user manually triggers the task with text.

15-day free trial – unlimited tasks

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

(By the way, have you seen our documentation? Have you joined the Slack community?)

Open source
View on GitHub to contribute to this task
Subscriptions
mechanic/user/text
Tasks use subscriptions to sign up for specific kinds of events. Learn more
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 %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more