=== Dashboard and Analytics for WooCommerce ===
Contributors: bnyamesa
Requires at least: 5.6
Tested up to: 6.8
Requires PHP: 7.2
Stable tag: 1.3.0
Text Domain: dashboard-and-analytics-for-woocommerce
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: woocommerce analytics, woocommerce dashboard, woocommerce reports, sales reports, order analytics

A clean, modern WooCommerce analytics dashboard. Track sales, orders, top products, refund rates, and order trends — all from one screen.

== Description ==

[Upgrade to Pro — from $6/month](https://finachub.com/dashboard-and-analytics-for-woo-commerce/) | [Live Demo](https://finachub.com/live-demo/)

**Stop flying blind. Know exactly what is happening in your store.**

WooCommerce has basic reports — but finding answers like "which products are performing best?" or "what is my average order value this week?" requires digging through multiple screens. This plugin puts the most important answers on one screen, updated automatically.

**What you get for free:**

* **Revenue at a glance** — Total Sales, Net Sales, Total Orders, and Product counts for any date range (up to 30 days)
* **Sales Over Time chart** — See daily, weekly, or monthly trends so you spot seasonality and spikes instantly
* **Top Selling Products** — Know which products drive your revenue so you can stock and promote them better
* **Popular Categories** — See which product categories generate the most income
* **Order Status breakdown** — See processing, completed, refunded, and cancelled orders at a glance
* **Average Order Value chart** — Daily AOV trend with comparison vs the previous period (Pro shows AOV by product category)
* **Refund Rate chart** — See what percentage of your orders are refunded (Pro shows which products drive refunds)
* **Orders by Day of Week** — Find your busiest selling day so you know when to run promotions (Pro adds revenue per day)
* **Recent Orders table** — Last 10 orders with customer, items, total, payment method, status, and date
* **Period-over-period trend arrows** — Every metric card shows whether you are up or down vs the previous period

Everything updates automatically every 15 minutes, and you can force-refresh anytime with one click.

**Why store owners upgrade to Pro:**

The free version shows you what is happening. Pro shows you why and what to do about it.

* Any custom date range up to 1 year (compare this quarter vs last quarter)
* **Cart Abandonment Rate chart** — track how your abandonment rate changes over time as you improve your checkout
* **Discounts vs. Average Order Value analysis** — see whether your coupons are growing revenue or just eroding margin
* **Customer Insights dashboard** — Average Order Value, Repeat Purchase Rate, New vs Returning, Lifetime Value, Churn Rate
* **Period comparison charts** — overlay this period vs last period on every chart
* **Full Orders list** — search, filter by status, sort by any column, paginate
* **CSV export** — export any report (orders, customers, products, categories) to a spreadsheet
* **Scheduled email reports** — get daily, weekly, or monthly summaries delivered to your inbox automatically
* **Priority support**

[Upgrade to Pro — from $6/month · $59/year](https://finachub.com/dashboard-and-analytics-for-woo-commerce/?utm_source=wp-dashboard&utm_medium=readme-cta&utm_campaign=wp-lite-plugin)

**Zero configuration needed.** Install, activate, and your data is live in under 30 seconds. Uses your existing WooCommerce data — no external services, no data ever leaves your server.

Compatible with WooCommerce High-Performance Order Storage (HPOS).

== Installation ==

1. In your WordPress admin go to **Plugins > Add New** and search for "Dashboard and Analytics for WooCommerce", or upload the ZIP via **Plugins > Add New > Upload Plugin**.
2. Click **Activate**.
3. Make sure WooCommerce (5.0 or newer) is installed and active.
4. Click **Dashboard & Analytics for WC** in the sidebar — your data is ready immediately.

== Frequently Asked Questions ==

= Does this replace the built-in WooCommerce Analytics? =
No — it runs alongside it. This plugin focuses on giving you a faster, cleaner overview with the metrics store owners check every day, plus actionable insights like refund rates and average order value trends that are hard to find in the default WooCommerce reports.

= Where does the data come from? =
All data is read directly from your WooCommerce database via the native `wc_get_orders()` API and the `wc_order_stats` / `wc_order_product_lookup` analytics tables. No data is sent to any external service.

= Is it compatible with High-Performance Order Storage (HPOS)? =
Yes. The plugin explicitly declares HPOS compatibility and uses WooCommerce's native `wc_get_orders()` API.

= Why is the free version limited to 30 days? =
The 30-day window covers the most common daily checks. For longer ranges — comparing this quarter to last quarter, or year-over-year trends — upgrade to Pro, which supports any range up to 1 year.

= Why does the Recent Orders list only show 10 orders? =
The free version gives you the latest 10 for a quick overview. Pro has a fully searchable, filterable, paginated list of all orders.

= The chart shows "Chart library not loaded" =
This is usually a JavaScript conflict from another plugin or your theme. Open your browser's developer console (F12) to see the error, and try temporarily disabling caching or JS optimisation plugins.

= What third-party libraries are included? =
* **Chart.js v4.4.1** — chart rendering ([github.com/chartjs/Chart.js](https://github.com/chartjs/Chart.js))
* **Daterangepicker v3.1** — date range picker ([github.com/dangrossman/daterangepicker](https://github.com/dangrossman/daterangepicker))
* **Moment.js** — loaded from WordPress core, used as a Daterangepicker dependency

= Does the plugin send any data externally? =
No. The only external request is loading the Jost font from Google Fonts on the plugin's admin pages. All analytics data stays on your server.

== Screenshots ==

1. The main dashboard — metric cards, trend arrows, and charts in one screen.
2. Sales Over Time chart with smart aggregation (hourly, daily, weekly, or monthly).
3. Average Order Value, Refund Rate, and Orders by Day of Week charts.
4. Recent Orders table with status badges, customer avatars, and payment method.
5. Upgrade to Pro page — full Lite vs Pro feature comparison.
6. Customer Insights dashboard (Pro feature).

== Changelog ==

= 1.3.0 =
* New: Average Order Value chart — daily AOV line chart with trend vs previous period; Pro shows AOV by product category.
* New: Refund Rate doughnut chart — accurate refund rate using only revenue-generating orders as the denominator; Pro shows which products drive refunds.
* New: Orders by Day of Week bar chart — highlights your busiest selling day; Pro adds revenue per day.
* Improvement: Chart cards now fall back to wc_get_orders() when the WooCommerce analytics tables have not yet been synced.
* Improvement: Chart data now uses the WordPress local timezone consistently, fixing day boundary mismatches on non-UTC stores.
* Improvement: Order status badges now have uniform sizing (min-width + centre alignment).
* Improvement: All "Upgrade to Pro" CTAs use a consistent dark green colour throughout.
* Fix: Chart cards were showing "no data" when orders existed — order status list is now derived dynamically so custom statuses are included automatically.
* Fix: Removed the 30-day date-cap hint bar that appeared in the dashboard header.

= 1.2.5 =
* Security: Added nonce checks to all AJAX actions to prevent CSRF vulnerabilities.
* Security: Hardened AJAX callback permissions to `manage_options`.
* Security: Escaped all AJAX-rendered HTML output to prevent XSS.
* Fix: Dashboard was accessible to non-admin logged-in users; access now restricted correctly.

= 1.2.2 =
* Fix: Upsell page styles were not loading due to a fragile asset loading check.

= 1.2.1 =
* Fix: Restored missing CSS for the redesigned Upgrade to Pro page.
* Fix: Resolved AJAX error on the Recent Orders table.

= 1.2.0 =
* New: Order Statuses doughnut chart.
* New: Period-over-period trend indicators on all metric cards.
* Enhancement: Color-coded trend arrows (green/red) for at-a-glance performance.
* Enhancement: Total Products card now counts new products created in the selected period.
* Enhancement: Complete visual overhaul for a more modern look.

= 1.1.1 =
* Enhancement: Modernized visual styling across the dashboard.
* Enhancement: Increased metric card height and added trend placeholder upsells.
* Fix: Asset version constant out of sync with plugin version.

= 1.0.6 =
* Security: Nonce verification added to date range selection.
* Security: Improved input handling — no longer processes raw `$_GET`/`$_POST` arrays.
* Fix: Date range parameters are now ignored if the nonce is missing or invalid.

= 1.0.2 =
* Fix: Chart library loading errors with fallback messages.
* Fix: Critical error in Recent Orders loop.
* Update: Top Selling and Categories charts now show top 5.
* Update: Removed hardcoded license activation logic.
* Improvement: HPOS compatibility declared explicitly.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.3.0 =
Adds three new analytics charts (Average Order Value, Refund Rate, Orders by Day of Week), fixes chart data accuracy for non-UTC timezones and custom order statuses. Update recommended.

= 1.2.0 =
Major update: new Order Statuses chart, fully functional trend indicators, and visual refresh. Highly recommended.
