Mechanic is a development and ecommerce automation platform for Shopify. :)
When an order is cancelled, this task waits 48 hours, and then permanently deletes the order. Simple as that! (Please note: if you only want to archive the cancelled order, not delete it, try a different task!)
Runs Occurs whenever an order is updated and Occurs whenever user/orders/delete_cancelled is triggered, with a 48 hour delay.
When an order is cancelled, this task waits 48 hours, and then permanently deletes the order. Simple as that! (Please note: if you only want to archive the cancelled order, not delete it, try a different task!)
When an order is cancelled, this task waits 48 hours, and then permanently deletes the order. There is no undo for deleting an order, so make sure this is what you want!
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?)
shopify/orders/updated user/orders/delete_cancelled+48.hours
{% if event.topic == "shopify/orders/updated" %} {% assign cache_key = "order-delete-scheduled-" | append: order.id %} {% assign order_qualifies = false %} {% if order.cancelled_at != blank and cache[cache_key] == blank %} {% assign order_qualifies = true %} {% endif %} {% if event.preview or order_qualifies %} { "action": { "type": "event", "options": { "topic": "user/orders/delete_cancelled", "data": { "order_id": {{ order.id | json }} } } } } { "action": { "type": "cache", "options": { "setex": { "key": {{ cache_key | json }}, "value": true, "ttl": {{ 60 | times: 60 | times: 48 }} } } } } {% endif %} {% elsif event.topic == "user/orders/delete_cancelled" %} {% assign order = shop.orders[event.data.order_id] %} {% if order.cancelled_at != blank or event.preview %} { "action": { "type": "shopify", "options": [ "delete", [ "order", {{ event.data.order_id | json }} ] ] } } {% endif %} {% endif %}