Undelete Bulk-Deleted Orders¶
Menu Location: Kiva Tools > Undelete Bulk-Deleted Orders
Last Updated: 2026-10-08
Overview¶
Before an order is deleted, the system writes a JSON snapshot of its rows. This happens both for bulk deletes from the Orders page and for a single order deleted from a customer's account. The Undelete Bulk-Deleted Orders page lists those snapshots so a mistaken delete can be undone: preview what a batch captured, then re-insert the orders.
This page appears under Kiva Tools in the admin menu.
Primary Functions:
- List every bulk-delete snapshot still on file for this store
- Preview a batch: when it was deleted, who deleted it, and the orders it captured
- Restore a batch, re-inserting its orders, line items, and payment rows
- Upload an order JSON file to re-create a single order
How Snapshots Are Made¶
A snapshot is written by the bulk delete action on the Orders page, and also when a single order is deleted from a customer's account (the customer info page). It is captured before the rows are removed, and includes:
- The
cust_orderrows - The order's line items (
cust_order_contents) - The payment rows (
cust_order_payment) - The transaction history rows (
trans_history)
Snapshots live on the server under the store's deleted-orders folder, grouped by date. Files older than 60 days are auto-purged by cron, so a batch is only recoverable within that window.
The Batch List¶
The default view lists every snapshot still on file, newest first.
| Column | Description |
|---|---|
| Deleted at | Date and time the batch was deleted |
| Admin | The admin user who ran the delete |
| Action | The label recorded for the delete, for example "single-order export" or a bulk delete |
| Count | How many orders were in the batch |
| Order IDs (first 10) | A preview of the order IDs (the list is truncated with an ellipsis when longer) |
| Status | Available (not yet restored) or Restored (already re-inserted) |
| Preview / Restore | Opens the batch; a restored batch shows a View link instead |
Show restored batches too / Hide restored batches toggles whether already-restored batches appear in the list. Restored batches are moved out of the pending folder into a restored folder.
If there are no snapshots, the page shows a "No bulk-delete snapshots on file for this tenant" notice.
Previewing and Restoring a Batch¶
Opening a batch with Preview / Restore shows a summary table:
- Deleted at, Admin user, Action, and the Filter URL (the Orders-page filter that was active for the delete)
- Order count, plus how many Contents rows and Payment rows the snapshot carries
Below that, the Orders in this batch table lists each order by Order ID, Customer, Name, Deliver On, Payment Total, and Status.
Restore re-inserts the orders from the snapshot. A confirmation asks first, because orders whose ID has already been re-used are skipped rather than overwritten.
Re-creating an Order from an Uploaded JSON File¶
The order info page has a Download JSON button (Kiva admin only, next to Create SQL) that saves one order as a order-<id>-<store>.json file. This is the recovery path when a snapshot is no longer on file or the order has to be moved from a restored backup.
Admins see a Re-create an order from a JSON file box at the top of this page:
- Choose the
.jsonfile downloaded with the Download JSON button - Click Upload & Restore and confirm
The upload runs the same restore engine as the on-disk snapshots: it re-inserts the order, its line items, and its payment rows. Orders whose ID already exists are skipped.
Common Use Cases¶
Undo a bulk delete. Find the batch under Orders, preview it to confirm the orders, then Restore.
Recover a single deleted order. Open the order's info page, use Download JSON, then upload that file here to re-create it.
Move an order from a restored backup onto the live store. Restore the backup locally, download the order as JSON, then upload it here.
Troubleshooting¶
The batch I need is not listed. Snapshots are written by the Orders-page bulk delete and by single-order deletes from a customer's account, and files older than 60 days are auto-purged by cron. A batch deleted outside that window, or one deleted another way, has no snapshot to restore. Use the JSON upload path instead if you have a file.
An order in the batch was skipped. Its ID already exists in cust_order on this store, so the restore leaves the existing row alone instead of overwriting it. The restore message names the skipped IDs.
A restore reported errors. The message lists the failing row and the database error. Nothing is force-overwritten; fix the cause and restore the batch again.
Recent Updates¶
2026-10-08: The Re-create an order from a JSON file upload box is no longer Kiva-admin only, so any admin sees it. The cross-store safeguard was removed: the Allow restoring even if the file is from a different store checkbox and the tenant-mismatch refusal are both gone, so an uploaded file restores onto whatever store you are on. Delete success messages on the Orders page and on a customer's account now link to this page so the undo is easy to find.
2026-10-08: Added the Kiva-admin Download JSON button on the order info page and the matching Re-create an order from a JSON file upload box on this page, so an order can be re-created from a file rather than only from an on-disk snapshot. The snapshot now also captures trans_history rows.
2026-10-08: A single order deleted from a customer's account is now snapshotted before deletion, the same as a bulk delete, so it appears here for recovery. The success message and activity log note say so.