=== Ninjalytics: Sales Reports & Order Export for WooCommerce and EDD ===
Contributors:      berrypress, kurowskanna, berrypressjonhall
Tags:              woocommerce, sales report, order export, reporting, product sales analytics
Requires at least: 6.2
Requires PHP:      8.1
Tested up to:      6.9
Stable tag:        2.0.14
License:           GPLv3 or later
License URI:       https://www.gnu.org/licenses/gpl-3.0.en.html

Create sales reports and order exports for WooCommerce with product analytics, order fulfillment data, filtering, charts, and 15+ templates.

==Description==

**Ninjalytics creates powerful sales reports and order exports for your WooCommerce store. Generate detailed product sales reports with charts, or export individual order line items for fulfillment and accounting. Choose from 15+ pre-built templates, customize which fields to include, filter by date ranges and order status, and preview everything live before downloading.**

Perfect for smart decision making, monitoring sales performance, order fulfillment, inventory management, and accounting. Works with both WooCommerce and Easy Digital Downloads.

Previously using "Product Sales Report for WooCommerce" and "Export Order Items for WooCommerce" as separate plugins? Ninjalytics replaces both - everything you need is now in one plugin, plus more.

### Reporting Features & Benefits

- **Live preview and one-click download** - see your data instantly before exporting
- **Pre-built report templates** - quickly create reports from 15+ ready-made templates including Top Selling Products, Stock Reports, Sales by Region, Live Carts analysis*, and more
- **Order Export Mode** - export individual order line items with full order details (billing/shipping info, order status, dates) - *replaces Export Order Items plugin functionality*
- **Flexible date ranges** - use quick shortcuts like "Last 7 days," "This Year," or set precise relative and absolute date ranges
- **Order status filtering** - include or exclude sales based on transaction status
- **Product-specific reporting** - store-wide reports, by product(s), product categories, and/or custom segmentation
- **Interactive charts** - create line and bar charts to help visualize your data
- **Report presets** - save custom report settings to regenerate reports later
- **Variation support** - report on variations separately or together
- **Custom sorting** - set display order for your data
- **Flexible field selection** - choose what fields to include in your report from dozens of available fields
- **Cost of Goods (COGS) tracking** - calculate profit and margins (requires compatible COGS plugin)
- **Exclude free products** - leave free products out of your report
- **Row limits** - set report to only include top X results
- **CSV export** - export in versatile CSV format for universal spreadsheet compatibility
- **High Performance Order Storage (HPOS)** - full support for WooCommerce's modern order storage system
- Works with [WooCommerce](https://wordpress.org/plugins/woocommerce/), [Live Carts for WooCommerce](https://wordpress.org/plugins/live-carts-for-woocommerce/) and [Easy Digital Downloads](https://wordpress.org/plugins/easy-digital-downloads/) (beta)


### View, Download, and Share

Use the report builder to quickly create a custom report, view in your dashboard, or click “Download Report” and your custom report will be generated and downloaded as a CSV. Import to your favorite spreadsheet software or share it with members of your team.

### Pre-Built Report Templates

Ninjalytics includes 15+ ready-to-use report templates to get you started quickly:

#### Product Sales Templates:
- **All Sales** - comprehensive sales overview with charts
- **Top Selling Products** - identify best performers by revenue
- **Top Rated Products**  - products with highest customer ratings, only available in Pro
- **Stock Report** - monitor inventory levels and identify restocking needs
- **Sales by Product** - detailed product performance breakdown

#### Geographic & Segmentation Templates:
- **Sales by US State** - regional sales analysis for US market
- **Sales by Country** - international performance tracking
- **Sales by Currency** - multi-currency sales breakdown
- **Sales by Payment Method** - payment gateway analysis

#### Order Export Templates:
- **New Order Export** - detailed order line items export for fulfillment
- **New Sales Report** - aggregated sales data overview

#### Live Carts Templates:
- **Live Carts Report** - aggregate cart statistics and trends
- **Live Carts Export** - individual cart details export
- **Carts by Status** - segment carts by status (active, abandoned, converted)
- **Average Cart Value** - monitor cart value trends over time

Requires free [Live Carts for WooCommerce](https://wordpress.org/plugins/live-carts-for-woocommerce/) plugin)

### Simple Filtering

Ninjalytics gives you a ton of control for zeroing in on what’s important. See what products are performing best based on quantity or sales so you can refine your online sales strategy. Filter by date range, order status, item, and/or category.

### Live Carts Integration

When you have the free [Live Carts for WooCommerce](https://wordpress.org/plugins/live-carts-for-woocommerce/) plugin installed (Pro version also [available](https://berrypress.com/product/woocommerce/live-carts/)), Ninjalytics automatically adds specialized reporting templates for analyzing abandoned and active shopping carts. Track cart abandonment rates, monitor cart values, and understand customer behavior before checkout to optimize your conversion funnel.

### Key Reporting Fields Available:

#### Product Sales Reports:
- Product ID, SKU, Name
- Variation ID, SKU, Attributes
- Product Categories
- Current Stock Quantity
- Quantity Sold
- Gross Sales
- Gross Sales (After Discounts)
- Total Sales Including Tax
- Cost of Goods Sold (COGS, Profit, Gross Margin)
- Order Count, Average Order Total
- Line Item Count
- And more...

#### Order Export Reports:
- Order ID, Status, Total, Date/Time
- Order Item Type, Line Item Name
- Billing Name, Phone, Email, Address, State
- Shipping Name, Phone, Email, Address
- Line Item Quantity, Gross, Total
- Order Shipping Methods
- Product details for each line item
- And more...

You can rename any field in your reports and reposition it.

*Note: The Pro version adds additional advanced fields including product prices, detailed taxes, refund data, customer notes, order notes, custom meta fields, and more. See "Get Pro Features" section for details.*

### Get Pro Features

If you are a power user needing advanced options for fine-tuning reports, [upgrade to pro](https://berrypress.com/product/woocommerce/ninjalytics/):

- **Email reports** - send reports to any email address with a single click, or use [scheduled reports addon](https://berrypress.com/product/woocommerce/scheduled-email-reports/) for automation
- **Multiple export formats** - save reports in XLSX (Excel), HTML, or Enhanced HTML formats in addition to CSV
- **Pie charts** - create pie charts for visual data representation (free version includes line and bar charts)
- **Alternative date ranges** - filter orders by paid date, completed date, or custom date fields (e.g., delivery date from other plugins) instead of order date
- **Custom calculated fields** - create your own formulas using arithmetic operators and built-in functions (Concatenate, Get Post Title, Get Permalink, Timestamp to Date/Time, and more) to calculate custom metrics
- **Advanced field customization** - include custom product/order meta fields
- **Expanded product filtering** - filter by product tags, custom fields, and product variation-specific attributes
- **Multiple custom segments** - use several custom segmentation fields at the same time for complex data grouping
- **User role filtering** - generate reports filtered by customer user roles (both default and custom roles)
- **Order meta filtering** - limit reports to orders matching specific custom meta field values (e.g., delivery date, custom order tags)
- **Advanced order fields** - access to Order Source, Order Notes, Customer Notes, Shipping State, and refund-related fields
- **Ninjalytics App** - access your reports on the go with the Ninjalytics app for Android or iOS (beta)!
- **Want more?** - check out our add-ons for expansion plugins


### Reviews

 ⭐️⭐️⭐️⭐️⭐️
>“I needed reports to help make informed decisions for ordering new stock from suppliers and the Ninjalytics was perfect. It can create very granular reports for specific product categories or one grand report for all our products. Well done!” `-`  @krooisant

 ⭐️⭐️⭐️⭐️⭐️
> “I was looking for good frontend reports for my marketplace and I came across the winning trio, [Ninjalytics](https://wpzone.co/product/product-sales-report-pro-for-woocommerce/), [Export Items Pro](https://wordpress.org/plugins/export-order-items-for-woocommerce/) in combination with [Frontend Reports](https://wpzone.co/product/frontend-reports-for-woocommerce/). This trio was the best for the job.” `-` Yinon Tubi



If you like this plugin, please consider leaving a comment or review.

### Documentation

Explore the full **Ninjalytics** documentation:

- [Introduction](https://berrypress.com/docs/ninjalytics/)
- [Compatibility](https://berrypress.com/docs/ninjalytics/compatibility)
- [Presets & Templates](https://berrypress.com/docs/ninjalytics/presets-and-templates)
- [Report Dates](https://berrypress.com/docs/ninjalytics/report-dates)
- **Report Configuration**
  - [Products](https://berrypress.com/docs/ninjalytics/report-configuration/products)
  - [Orders](https://berrypress.com/docs/ninjalytics/report-configuration/orders)
  - [Segmentation](https://berrypress.com/docs/ninjalytics/report-configuration/segmentation)
  - [Fields](https://berrypress.com/docs/ninjalytics/report-configuration/fields)
  - [Table & Downloads](https://berrypress.com/docs/ninjalytics/report-configuration/table-and-downloads)
  - [Charts](https://berrypress.com/docs/ninjalytics/report-configuration/chart)
  - [Data & Display](https://berrypress.com/docs/ninjalytics/report-configuration/data-and-display)
- [Extending Ninjalytics](https://berrypress.com/docs/ninjalytics/extending)

### Addons & Integrations

Looking to automate your reports, share them on the frontend of your site, or export details about an individual sale for order fulfillment? Upgrade or become a member for access to these add-ons:

[Scheduled Email Reports](https://wpzone.co/product/scheduled-email-reports-for-woocommerce/) - email your reports as an attachment on a recurring schedule
[Frontend Reports](https://wpzone.co/product/frontend-reports-for-woocommerce/) - embed a report or a download link in a post or a page
[Export Order Items Pro](https://wpzone.co/product/export-order-items-pro-for-woocommerce/) - export order details for use in order fulfillment and data analysis


## You may also like these plugins

[BerryPress](https://berrypress.com/) has built a range of powerful plugins for WooCommerce and WordPress. Check out some of our favorites below - and don’t forget to leave a ⭐⭐⭐⭐⭐ review to help others in the community discover them!

- [Inline Image Upload for BBPress](https://wordpress.org/plugins/image-upload-for-bbpress/) - Add a TinyMCE WYSIWYG editor to BBPress forums and enable inline image uploads, so users can easily attach and display images within their posts.
- [PhotoBerry Studio](https://wordpress.org/plugins/photoberry-studio/) - Create beautiful, customizable product photo galleries directly in your WordPress dashboard.
- [Automatic Product Categories](https://berrypress.com/product/woocommerce/automatic-product-categories/) - Available as a free version and Pro. Automatically assign products to categories based on custom rules, saving you time and keeping your store organized.
- [Live Carts for WooCommerce](https://wordpress.org/plugins/live-carts-for-woocommerce/) - Free plugin to view and analyze live shopping carts in real time to understand user behavior and optimize conversions ([Pro version](https://berrypress.com/product/woocommerce/live-carts/) also available). **Integrates with Ninjalytics** to add 4 specialized cart reporting templates.
- [Customer Address Change Notification for WooCommerce](https://wordpress.org/plugins/customer-address-change-notification-for-woocommerce/) - Get instant notifications when customers update their shipping or billing address, helping you stay on top of changes and prevent delivery issues.
- [LoginBerry](https://wordpress.org/plugins/loginberry/) - Automatic email verification for WordPress accounts. Stops fake signups by requiring a 6-digit activation code before users can log in - zero configuration needed.

To view BerryPress's premium WordPress plugins and themes, visit our [WordPress products catalog page](https://berrypress.com/shop/).

Enjoy!


== Frequently Asked Questions ==

= Why I see additional decimal places in some fields?

In some cases output may be affected by the limited precision of PHP's floating point numbers (see the warning in the PHP manual: https://www.php.net/manual/en/language.types.float.php). This may occur retrieving values from the database, when the plugin does calculations after retrieving values from the database, such as when a report field consists of two database fields added together, or when calculating the totals row. When this occurs, a tiny fractional error may be introduced each time a calculation is performed, typically less than 0.000000000000001 per calculation or retrieval. This is not likely to affect the accuracy of the output in normal usage where only a few decimal places are used, even if a value has been derived from many calculations such as the totals row in a very long report. However, if output rounding is not in effect, you may see unexpected additional decimal places in some fields in your output. In this case we recommend rounding the output values as needed.

= What’s the difference between Ninjalytics and Export Order Items? =

**Important:** Ninjalytics now includes Order Export functionality that replaces [Export Order Items](https://wordpress.org/plugins/export-order-items-for-woocommerce/). We will be deprecating the standalone Export Order Items plugin in the future.

**Two Reporting Modes:**
- **Product Sales Reports** (default): Aggregate data by product - perfect for analyzing sales performance, comparing products, tracking inventory, and making purchasing decisions.
- **Order Export Mode**: Export individual order line items with full order details - ideal for order fulfillment, accounting, and detailed order analysis.

**Migration from Export Order Items:**
If you're currently using Export Order Items, Ninjalytics can automatically import your saved settings. Simply install Ninjalytics and your previous report configurations will be available as presets. You'll find the "Order Export" template option when creating new reports, which provides the same functionality as Export Order Items.


= What’s the difference between the free and pro version? =

The free version is powerful and works well for most store owners, providing access to all core reporting features including Order Export mode, pre-built templates, charts, and CSV export.

The [pro version](https://berrypress.com/product/woocommerce/ninjalytics/?utm_campaign=upsell&source=ninjalytics-free-readme) adds advanced capabilities for power users:
- **Multiple export formats** (XLSX/Excel, HTML, Enhanced HTML)
- **Email reports** to any address with one click
- **Alternative date filtering** (by Order Paid Date or Completed Date)
- **Custom calculated fields** with your own formulas
- Include any **custom product/order meta fields**
- **Advanced filtering** by product tags, user roles, and order meta fields
- **Multiple custom segments** for complex data grouping
- **Ninjalytics Mobile App** (iOS & Android beta)
- **Premium support** with faster response times

See the "Get Pro Features" section above for the complete list.

= Can I schedule my reports to send automatically? =

We built [Scheduled Email Reports for WooCommerce](https://wpzone.co/product/scheduled-email-reports-for-woocommerce/) as a premium add-on that can be used to schedule reports from both Ninjalytics and [Export Order Items](https://wordpress.org/plugins/export-order-items-for-woocommerce/).

= Where can I get your other add-ons for WooCommerce? =
After you install and activate Ninjalytics, open the Ninjalytics page from the WordPres admin menu, and select the Addons tab to install free and premium feature upgrades for your ecommerce store.

= Where can I find the documentation? =

Full documentation with setup guides, configuration details, and troubleshooting tips is available here:
[https://berrypress.com/docs/ninjalytics/](https://berrypress.com/docs/ninjalytics/)

You can also access specific topics directly, including [compatibility](https://berrypress.com/docs/ninjalytics/compatibility), [presets & templates](https://berrypress.com/docs/ninjalytics/presets-and-templates), and [report configuration](https://berrypress.com/docs/ninjalytics/report-configuration/).

---

= How can I get support? =


For technical issues or custom configuration questions, please open a private support ticket here:
[https://help.berrypress.com/open.php](https://help.berrypress.com/open.php)

We recommend avoiding posting access details in public threads - use the private form above for secure communication.

For general questions or community support, you can also open a ticket on the WordPress.org forum:
[https://wordpress.org/support/plugin/product-sales-report-for-woocommerce/](https://wordpress.org/support/plugin/product-sales-report-for-woocommerce/)

---

= Is Ninjalytics compatible with my theme or plugins? =

Ninjalytics is built to work with most third-party plugins. If you encounter a conflict, please contact support with details.

---

= Does Ninjalytics work with Live Carts for WooCommerce? =

Yes! When you have the free [Live Carts for WooCommerce](https://wordpress.org/plugins/live-carts-for-woocommerce/) plugin installed (Pro version also [available](https://berrypress.com/product/woocommerce/live-carts/)), Ninjalytics automatically adds 4 specialized report templates for cart analysis:
- Live Carts Report - aggregate cart statistics
- Live Carts Export - individual cart details
- Carts by Status - segment by status (active, abandoned, converted)
- Average Cart Value - monitor trends over time

This integration helps you analyze cart abandonment, track cart values, and understand customer behavior before checkout.

---

= How do I use Ninjalytics with WPML (multilingual products)? =

If you're using WPML or another multilingual plugin that creates separate product entries for each language, we recommend using the **"By products or variations (based on SKU)"** grouping option. This setting groups all language variations of the same product together based on their shared SKU, giving you accurate consolidated sales data across all languages.

To enable this:
1. Create your report
2. In the report settings, look for the grouping options
3. Select "By products or variations (based on SKU)"

This ensures that a product sold in English, German, and French will appear as one combined entry in your report rather than three separate entries.

---

== Installation ==

1. Click "Plugins" > "Add New" in the WordPress admin menu.
2. Search for "Ninjalytics".
3. Click "Install Now".
4. Click "Activate Plugin".

Alternatively, you can manually upload the plugin to your wp-content/plugins directory.

== Frequently Asked Questions ==

== Screenshots ==

1. Report options
2. Sample output (simulated)

== Changelog ==

= 2.0.14, 2026-03-29 =
- Re-ordering fields in the list automatically changes table column order without ajax refresh
- Change the sort order field or direction settings automatically re-orders the table without an ajax refresh
- Changing a field name renames the column without an ajax refresh
- Clicking a table column heading to sort the table automatically updates the sort order and/or direction dropdown
- Dragging columns in the table to change order automatically updates the order of the fields list

= 2.0.13, 2026-03-27 =
- Fix: Date range selector now correctly includes refund orders when calculating available year ranges
- Fix: Import settings from Export Order Items plugin
- Fix: PHP errors related to namespaces in some configurations
- Fix: Shipping methods field filtering and ordering
- Update: WooCommerce tested up to 10.6

= 2.0.12, 2026-02-22 =
- Add: field order count field
- Add: this year and last year date options to quick date

= 2.0.11, 2026-02-05 =
- Add: Quick Dates (last X days, etc) to report dates
- Fix: Order source issue
- Fix: "Other" (custom) report fields should have disabled state

= 2.0.10, 2026-01-23 =
- Fix: Enable custom segments toggle not working

= 2.0.9, 2026-01-08 =
- Add: New Live Carts templates and improvements to existing ones
- Fix: Issues when Ninjalytics Pro is active
- Add: Notice on charts when duplicate series values are detected
- Fix: The berrypress-page body class being added to other admin pages, which could cause styling issues
- Fix: Potential JavaScript error on the report page
- Fix: Add a seconds component to absolute time when missing
- Improvement: Remove unused files ahead of the redesign
- Other: Miscellaneous minor improvements and fixes

= 2.0.8, 2025-12-30 =
- Styling Improvements
- Add: new report page
- Add: filtering for report templates
- Miscellaneous improvements: translatable strings, accessibility, etc.
- Fix and improvements: capability checks
- Improvement: product search select
- Add: Order export and Live Carts reports

= 2.0.7, 2025-12-15 =
- Fix issue after deleting report preset

= 2.0.6, 2025-12-09 =
- Add message when trying to connecting to Ninjalytics App Beta

= 2.0.5, 2025-11-18 =
- Add support for Cost of Goods
- Add new fields:
    - Cost of Goods Sold
    - Profit
    - Gross Margin
    - Current COGS per item

= 2.0.4, 2025-11-11 =
- Fix php warning
- Licenses update
- Licenses update
- Admin framework hooks changes
- Fix scroll issue
- Fix issue with month based date offset in start date
- Improvement: update start/end time defaults
- Minor styling changes

= 2.0.3, 2025-10-16 =
- Miscellaneous back end improvements

= 2.0.2 =
- Add addons tab
- Change tooltip styling
-Fix: Resolved an issue where the report templates - Sales by US State, Sales by Payment Method, Sales by Currency, and Sales by Country - were not functioning correctly

= 2.0.1 =
- Fix toggle issues
- Fix report templates

= 2.0.0 =
- Rebrand to Ninjalytics
New features:
- Live report table and chart previews
- Expanded report fields and data options
- Quick report creation from pre-built templates
- Detailed product sales reports including variations and shipping data
- Modern, intuitive reporting interface
- Interactive line and bar charts for data visualization
- Save and reuse multiple custom report configurations
- Flexible date range selection with relative and absolute time ranges
- Custom data segmentation and grouping options
- Row count limits - show only the top X results
- Customizable CSV export settings (delimiters, quotes, escape characters)
- Support for both WooCommerce and Easy Digital Downloads (beta)

= 1.5.6 =
* Revert: "Limit Gross Sales and Gross Sales (After Discounts) fields to 10 decimal places (amounts are rounded if more than 10 decimal places)"

= 1.5.5 =
April 26, 2023
* Add High Performance Order Tables support (beta)

= 1.5.4 =
April 17, 2023
* Security update
* Limit Gross Sales and Gross Sales (After Discounts) fields to 10 decimal places (amounts are rounded if more than 10 decimal places)

= 1.5.3 =
March 12, 2023
* Fix: The option to use the report preset's date range settings wasn't working in Scheduled Email Reports

= 1.5.2 =
September 23, 2022
* Display reporting presets list in alphabetical order

= 1.5.1 =
* Fix: Removed incorrect/outdated note regarding line item refund creation when the order status is changed to Refunded (WooCommerce 2.4+ should automatically create line-item refunds when the status of an order is set to Refunded)
* Feature: Added intermediate rounding option
* Feature: Added debug mode option

= 1.5.0 =
* Security fix: Improve browser caching disabling headers
* Load styles and js only on the plugin admin page
* Updated WP and WooCommerce tested up to
* Rebranded admin page
* Added a link to plugin settings page
* Updated links
* Added addons tab
* Updated readme and assets

= 1.4.10 =
* Added messaging on admin page about line item refunds

= 1.4.9 =
* Updated license (GPLv3+)
* Removed social media embeds from admin page

= 1.4.8 =
* Fixed review/donate notification not being hidden

= 1.4.7 =
* Fixed incorrect date ranges when using the "Last 7 days", "Last 30 days", "Next 7 days", or "Next 30 days" options
* Added calendar month date range options
* Fixed conflict with Product Sales Report Pro

= 1.4.6 =
* Fixed potential incompatibility with order status plugin(s)

= 1.4.5 =
* Fixed potential incompatibility with custom order statuses

= 1.4 =
* Added the ability to select multiple product categories
* Added an option to limit the report to specified product IDs
* Added an option to limit the report to orders with specified statuses

= 1.3.2 =
* Added an option to exclude free products

= 1.3 =
* Added a View Report option

= 1.2.4 =
* Added a date picker for browsers without support for the HTML5 date input

= 1.2.2 =
* Removed anonymous function to improve compatibility with old versions of PHP

= 1.2.1 =
* Fixed bug affecting products with no categories

= 1.2 =
* Added Product Categories field

= 1.1.7 =
* Added Variation SKU field

= 1.1.6 =
* Added Gross Sales (After Discounts) as sort field

= 1.1.5 =
* Added field for gross sales after discounts

= 1.1.4 =
* Added Pro version info

= 1.1.2 =
* Made report settings persistent (options are saved when a report is generated)

= 1.1.1 =
* Fixed timezone issue affecting the report period

= 1.1 =
* Added checkboxes to select which fields to include in the report
* Added the Product SKU field

= 1.0 =
* Initial release

== Upgrade Notice ==

= 1.4.7 =
When using the "Last 7 days", "Last 30 days", "Next 7 days", or "Next 30 days" options in previous versions of the plugin, the computed date range included one too many days. We recommend updating immediately to ensure data accuracy.
