Tags: Cancel, Orders, Unpaid
This task scans for orders that are more than X days or hours old that have a financial status of "pending", and ensures that they are all closed/archived and cancelled. Pending orders that are already closed will be cancelled, and pending orders that are already cancelled will be closed. Optionally, choose to add a tag to such orders, and whether to restock line items.
- View in the task library: tasks.mechanic.dev/cancel-and-close-unpaid-orders-after-two-days
- Task JSON, for direct import: task.json
- Preview task code: script.liquid
{
"only_process_orders_having_this_tag": null,
"ignore_orders_having_this_tag": null,
"period_to_wait_before_checking_each_order__number_required": 1,
"period_to_wait_is_in_hours__boolean": false,
"period_to_wait_is_in_days__boolean": true,
"tag_to_add_to_the_order": null,
"cancellation_reason_to_set": "other",
"restock_line_items__boolean": null,
"send_cancellation_email_to_customer__boolean": false,
"test_mode__boolean": true
}
Learn about task options in Mechanic
{% if options.period_to_wait_is_in_hours__boolean %}
mechanic/scheduler/hourly
{% elsif options.period_to_wait_is_in_days__boolean %}
mechanic/scheduler/daily
{% endif %}
mechanic/user/trigger
Learn about event subscriptions in Mechanic
This task scans for orders that are more than X days or hours old that have a financial status of "pending", and ensures that they are all closed/archived and cancelled. Pending orders that are already closed will be cancelled, and pending orders that are already cancelled will be closed. Optionally, choose to add a tag to such orders, and whether to restock line items.
If configured with an interval in hours, this task will run hourly. If configured with an interval in days, the task will run every night at midnight, in your store's local timezone. Run this task manually to perform the scan on demand.
Run first using test mode, to ensure expected results before running without it.
Find this task in the library at tasks.mechanic.dev, and use the "Try this task" button. Or, import this task's JSON export – see Importing and exporting tasks to learn how imports work.
Found a bug? Got an improvement to add? Start here: ../../CONTRIBUTING.md.
Submit your task requests for consideration by the Mechanic community, and they may be chosen for development and inclusion in the task library!