WooCommerce Reporting Toolkit
Custom WooCommerce reporting toolkit demonstrating PHP, SQL, WordPress APIs, data aggregation, exports, and production performance optimization.
by M.J. O'Brien · github.com/swamp-rabbit/woocommerce-reporting-toolkit
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/swamp-rabbit/woocommerce-reporting-toolkit/archive/refs/heads/main.zipA portfolio-ready WordPress/WooCommerce plugin demonstrating custom reporting, data aggregation, exports, and production-oriented performance work.
Portfolio project: This repository is a generalized and sanitized version of reporting functionality developed for a production WooCommerce implementation. Client-specific names, configuration, business rules, and identifying information have been removed. No client data, credentials, API keys, or production configuration are included.
What it demonstrates
- WordPress admin menu and report-page development
- WooCommerce order and line-item processing
- PHP/OOP and WordPress hooks
- Direct SQL reporting with
$wpdband prepared statements - CSV and spreadsheet-friendly exports
- Capability checks and WordPress nonces
- Customer aggregation and drill-down reporting
- Historical product-weight snapshots
- Performance optimization for large order histories
- Practical maintenance of a legacy WooCommerce order-table implementation
Reports
Customer Weight Report
Aggregates monthly order weight by customer, identifies customers and individual orders that meet a configurable threshold, and exports results to CSV. Product weight is snapshotted to order-line metadata at checkout so historical reports are not changed by later catalog edits.
Sales by Purchase Type
Reports product quantity and revenue for configurable purchase-type groupings, with date filtering, SKU/product/size detail, net-style totals, CSV export, and spreadsheet export.
The demonstration assumes a purchase_type order meta value of consumer or business. The business grouping also recognizes a populated billing company field. These are example conventions and can be adapted to a store's data model.
First-Time Customers
Finds customers whose earliest qualifying order falls within a selected year, summarizes first-order revenue by month, provides a customer drill-down, and exports the results to CSV.
The original implementation loaded large numbers of WC_Order objects into PHP memory. The portfolio version preserves the production optimization: MySQL identifies the earliest qualifying order per normalized billing email and returns only the rows needed for the selected year.
Requirements
- WordPress 6.0+
- PHP 8.0+
- WooCommerce
- Legacy WooCommerce order storage (posts/postmeta)
The plugin intentionally declares HPOS incompatibility because the Sales by Purchase Type and First-Time Customers examples query the classic WooCommerce order tables directly. A production HPOS version would use the WooCommerce query APIs or HPOS tables.
Installation
- Copy
woocommerce-reporting-toolkittowp-content/plugins/. - Activate WooCommerce Reporting Toolkit.
- Open WooCommerce Reporting Toolkit in WordPress admin.
- Choose a report.
Security / privacy notes
The repository contains no customer records or production data. Reports operate on the WooCommerce data of the site where the plugin is installed. Export actions require the manage_woocommerce capability and use WordPress nonces.
Portfolio context
This code is presented to demonstrate the kinds of WordPress/WooCommerce problems I solve in production: custom business reporting, SQL/data work, plugin development, debugging, performance remediation, and maintainable admin tooling.
It is not intended as a drop-in analytics replacement for every WooCommerce store; stores differ in order storage, metadata conventions, product configuration, and reporting requirements.
License
GPL-2.0-or-later