Skip to content

Export beta

Order Lifecycle events can be exported as a CSV file for analysis in spreadsheets, BI tools, or data warehouses. The export feature lives in Order Lifecycle → Export in the Craft sidebar.

Date Range

Presets

Quick-select buttons cover the most common windows:

PresetDescription
TodayMidnight to 23:59:59 today
YesterdayFull previous day
Last 7 / 30 / 90 daysRolling window from now
This MonthFirst to last day of the current calendar month
Last MonthFull previous calendar month
This Year1 January to today
Last 365 daysRolling one-year window
All TimeEvery event in the database (from 1 January 2000)

Clicking a preset highlights it and fills in the Date From and Date To fields automatically.

Custom Range

The Date From and Date To fields accept any date and time. Set them manually to export a specific window.

Filtering

Order ID

Enter a specific order ID to export events for a single order only. Leave blank to include all orders in the date range.

Event Types

Check individual event types to limit the export to those events. If no types are selected, all event types are included.

The event types are presented as a grouped checkbox list inside a semantic <fieldset>, so the whole group is announced together by assistive technology.

Export form filters

Columns

The Columns to Export table controls which fields appear in the CSV and in what order. Toggle each column on or off with its lightswitch. Drag rows by their handle to reorder columns.

ColumnDescription
Log IDInternal log entry ID
Date/TimedateCreated timestamp
Order IDCommerce order ID
Order NumberCommerce order number (hash)
Event TypeEvent type string (e.g. orderCompleted)
MessageAuto-generated or custom event description
Customer EmailEmail address on the order at export time
Order StatusCurrent order status name
Total PriceOrder total at export time
CurrencyOrder currency code
Payload (JSON)The payload key from the event snapshot

WARNING

Customer Email, Order Status, Total Price, and Currency reflect the order's current state, not its state at the time the event was logged. Use the Payload (JSON) column for point-in-time values captured in the snapshot.

Downloading

Click Export CSV to download the file. The file is named lifecycle-events-YYYY-MM-DD-HHmmss.csv.

Console Alternative

Large exports can also be done via the CLI to avoid HTTP timeouts:

bash
php craft order-lifecycle/logs/stats

For a programmatic export, query the orderlifecycle_logs table directly via Craft's database layer:

php
use craft\db\Query;

$rows = (new Query())
    ->select(['id', 'orderId', 'type', 'message', 'dateCreated'])
    ->from('{{%orderlifecycle_logs}}')
    ->where(['>=', 'dateCreated', '2024-01-01 00:00:00'])
    ->orderBy(['dateCreated' => SORT_ASC])
    ->all();