# Delete stale draft orders after N days

Deletes draft orders that still exist after a configurable waiting period.

Canonical URL: https://templates.jsworkflows.com/templates/delete-stale-draft-orders-after-30-days/

## When to use this template

This template is built for Shopify stores using the JsWorkflows app.

Use this template when you want a ready-made workflow for this use case: Deletes draft orders that still exist after a configurable waiting period.

It is designed for Shopify order operations and gives you a production-ready starting point instead of building the automation from scratch.

This workflow uses the Shopify webhook trigger model and starts from the "Draft order created" trigger. It includes setup fields for merchant-facing values, so you can configure the workflow before installing it.

## Metadata

- Category: Orders
- Trigger: Draft order created
- Workflow type: Shopify webhook
- Complexity: medium
- Usage class: starter-friendly

## Connected services

- None

## Additional Shopify scopes

- read_draft_orders
- write_draft_orders

## Setup fields

- Delete after days (`DELETE_AFTER_DAYS`)
  - Type: number
  - Storage: config
  - Required: yes
  - Description: How many days to wait before re-checking and deleting the draft order if it still exists.

## Setup guide

## Before you start

This template watches new draft orders and deletes them after a configurable delay if they still exist.

## Configure in setup

- `Delete after days`: how long to wait before checking and deleting the draft order

## Notes

- If the draft order has already been deleted or converted, the workflow does nothing
- The delay is scheduled at workflow runtime, so changing the setting only affects future draft orders

