Liability Snapshots
WalletPro schedules a daily WordPress cron job that records the total outstanding wallet liability as a point-in-time snapshot. The Liability Snapshot screen renders up to 90 days of history as a trend chart, shows whether the latest snapshot is stale, and lets you download the full history as a CSV or trigger an immediate snapshot without waiting for the next cron fire.
How it works
Every day at the time WP-Cron next runs after midnight UTC, WalletPro fires the walletpro_daily_snapshot event. The handler calls LiabilitySnapshotService::takeSnapshot(), which sums the live wallet balances and writes one row to walletpro_liability_snapshots:
| Column | Value |
|---|---|
| snapshot_date | Yesterday's calendar date (the period the snapshot covers). |
| total_liability | Sum of all positive wallet balances at the time of capture. DECIMAL(15,4). |
| wallet_count | Number of customers with a non-zero balance. |
| created_at | UTC timestamp when the snapshot was written. |
Snapshots are never overwritten. Each cron fire appends a new row, so the table is append-only and safe to export for audit purposes.
Where to find it
Go to WooCommerce > Liability Snapshot. The screen requires the manage_woocommerce capability.
The trend chart
The chart plots total outstanding liability across the last 90 snapshots. Each point on the line corresponds to one snapshot row. Hovering a point shows the exact date, liability total, and wallet count. The chart is rendered with Chart.js (bundled) and falls back gracefully when JavaScript is unavailable, the raw data table is always rendered below the chart.
Staleness warning
If the most recent snapshot is more than 25 hours old (90,000 seconds), the screen renders a yellow warning banner reporting that liability data may be stale because no snapshot has been taken in the last 25 hours, and prompting you to run Take snapshot now or wait for the next daily cron tick. This usually means WP-Cron is not running on schedule. Check your cron configuration or use a real cron to call wp-cron.php directly.
WP-Cron fires on page load. On a low-traffic store the daily snapshot may be delayed by hours or skipped entirely if no page loads occur. Use a server-side cron (*/5 * * * * wget -q -O /dev/null https://yourdomain.com/wp-cron.php?doing_wp_cron) to keep it reliable.
Taking a snapshot now
Click the Take snapshot now button at the top of the screen to write an immediate snapshot without waiting for cron. The button submits a POST form protected by a nonce. The newly created row appears in the chart and table after the redirect.
CSV export
The Download CSV button exports all rows in the walletpro_liability_snapshots table, oldest first. Columns: Date, Total liability, Wallet count, Recorded at (UTC). The export endpoint requires manage_woocommerce and a nonce.
Database table
The snapshots table is created during plugin installation or upgrade (DB_VERSION 20). It is dropped automatically on plugin uninstall.
walletpro_liability_snapshots (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
snapshot_date DATE NOT NULL,
total_liability DECIMAL(15,4) NOT NULL DEFAULT 0,
wallet_count INT UNSIGNED NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL
)
Hook reference
| Hook | Type | When it fires |
|---|---|---|
| walletpro_daily_snapshot | Action | WP-Cron event, fires once per day. Add your own handler to run alongside the built-in snapshot logic. |