WP Manifestindependent plugin directory
manifest / analytics / wc-sales-insights

WooCommerce Sales Insights

A lightweight WooCommerce reporting plugin providing sales totals, daily averages, trend analysis, refunds, shipping metrics, and CSV exports using WooCommerce's official order APIs with HPOS support.

by Vladimir Radisic · github.com/vladirad/wc-sales-insights

★ 0stars
0forks

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/vladirad/wc-sales-insights/archive/refs/heads/main.zip

A lightweight WooCommerce reporting plugin providing sales totals, daily averages, trend analysis, refunds, shipping metrics, and CSV exports using WooCommerce's official order APIs with HPOS support.

Features

  • Inclusive manual date ranges plus Last 7 days, Last 30 days, This month, Last month, and This year presets
  • Nine aggregate metrics and an accessible, responsive daily trend chart
  • Product-return reporting that excludes refunded tax and shipping
  • Authenticated CSV export with a row for every calendar day
  • Paginated WooCommerce CRUD queries and a versioned 15-minute transient cache
  • Pure calculation classes covered by PHPUnit

Screenshots

Screenshots have not yet been added. When available, they will live in docs/screenshots/.

Installation

  1. Run composer install --no-dev --optimize-autoloader in the plugin directory.
  2. Place the directory in wp-content/plugins/wc-sales-insights.
  3. Activate WooCommerce Sales Insights with WooCommerce active.
  4. Open WooCommerce → Sales Insights.

Metrics explained

  • Total Sales: full amount charged on paid orders, including products, tax, and shipping. Refunds are shown separately.
  • Net Sales: product line totals after discounts, excluding tax and shipping, less product-only refunds.
  • Product Returns: refunded product value only; refunded tax and shipping are excluded.
  • Shipping Charged: customer shipping charges excluding shipping tax.
  • Average Gross / Day: Total Sales divided by inclusive calendar days.
  • Average Net / Day: Net Sales divided by inclusive calendar days.
  • Average Order Value: Total Sales divided by Paid Orders; zero when there are no orders.

Architecture

WooCommerce Orders (CRUD APIs)
        ↓
OrderRepository
        ↓
SalesCalculator → ReportResult
        ↓
    SalesReport + Cache
        ↓
 ┌──────────────┬────────────┐
 │ Admin Report │ CSV Export │
 └──────────────┴────────────┘

OrderRepository pages through paid orders and normalizes WooCommerce objects. SalesCalculator is framework-independent aggregation logic. SalesReport coordinates caching, and presentation/export classes remain consumers of the same result.

HPOS compatibility

The plugin declares HPOS compatibility with WooCommerce's FeaturesUtil. It uses wc_get_orders(), WC_Order, and order item APIs and makes no assumptions about whether orders live in WordPress posts or WooCommerce custom order tables.

Development

Requires PHP 7.4 or newer.

composer install
composer test
composer phpcs

Extending

  • wcsi_paid_statuses filters the prefixed statuses used by the order query.
  • wcsi_order_query_args filters WooCommerce CRUD query arguments.
  • wcsi_cache_ttl filters the report cache lifetime in seconds.
  • wcsi_report_result filters the calculated ReportResult before caching.
  • wcsi_report_metrics filters the label/value cards rendered in the admin report.

Limitations

“Paid orders” means orders in the statuses returned by WooCommerce's wc_get_is_paid_statuses(), unless filtered. Metrics use order creation date, matching the original report behavior. This is an operational reporting tool, not an accounting ledger, tax report, or replacement for WooCommerce Analytics. Currency conversion is outside its scope; cache identity includes the active store currency.

License

GPL-2.0-or-later. See LICENSE.