fetch("SELECT * FROM orders WHERE order_id = :id", ['id' => $orderId]); if (!$order) { setFlash('error', 'Order not found'); header('Location: /admin/orders.php'); exit; } // Handle status update if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action'] ?? ''; if ($action === 'update_status') { $status = $_POST['status'] ?? ''; $trackingNumber = $_POST['tracking_number'] ?? ''; $updateData = ['order_status' => $status]; if ($trackingNumber) { $updateData['tracking_number'] = $trackingNumber; } db()->update('orders', $updateData, 'order_id = :id', ['id' => $orderId]); setFlash('success', 'Order status updated'); header('Location: /admin/order.php?id=' . $orderId); exit; } if ($action === 'add_note') { $note = trim($_POST['note'] ?? ''); if ($note) { $existingNotes = $order['notes'] ?? ''; $newNote = '[' . date('M j, Y g:i A') . '] ' . $note; $allNotes = $existingNotes ? $existingNotes . "\n" . $newNote : $newNote; db()->update('orders', ['notes' => $allNotes], 'order_id = :id', ['id' => $orderId]); setFlash('success', 'Note added'); header('Location: /admin/order.php?id=' . $orderId); exit; } } } $items = json_decode($order['items'], true) ?? []; $shippingAddress = json_decode($order['shipping_address'], true) ?? []; $statuses = ['pending', 'confirmed', 'processing', 'shipped', 'delivered', 'cancelled', 'refunded']; ?>

Order Items

0): ?> 0): ?> 0): ?>
Product Price Qty Total
Subtotal
Shipping
Tax
Discount -
Total

Order Notes

No notes yet.

Order Status

Shipping Address


,

Payment

Method
Status 'success', 'failed' => 'error', 'refunded' => 'warning', default => 'primary' }; ?>
Stripe ID ...

Timeline

Created
Updated