Home > WooCommerce > Docs > WooCommerce Custom Reports: An Ultimate Guide

WooCommerce Custom Reports: An Ultimate Guide

Last updated: August 01, 2024
Written and researched by experts at AvadaLearn more about our methodology

By Sam Nguyen

CEO Avada Commerce

Many businesses utilize WooCommerce to build e-commerce platforms on their WordPress websites. One of the reasons for the growth is its adaptability, making it an excellent choice for large and small organizations. Creating WooCommerce custom reports to track critical data is an essential part of establishing a scalable website.

The WooCommerce reporting services require a strong comprehension of how to use by administrators. By data analysis, these reports offer essential insight into the store’s performance.

Therefore, we have put the article WooCommerce Custom Reports: An Ultimate Guide to help you guys figure it out. In this article, you will have an in-depth understanding of the WooCommerce reports, and we will share the necessary steps to generate reports for WooCommerce that you can apply when establishing your online store.

Types of WooCommerce Reports

Default and Custom reports are the two primary types of reports that WooCommerce may create.

Default Reports

Default WooCommerce reporting provides generic data based on the overall success of your e-commerce store. You may see them right away on WooCommerce’s admin site’s Reports tab.

You can browse four different sorts of default reports:

Orders: This report calculates your product’s gross and net sales volume. You may also examine which things are the most popular or profitable. This data can also be sorted and filtered according to certain dates, goods, or categories.

orders

Customers: The Consumer report can provide you with critical data if you have customer accounts. This will display the number of new sign-ups for a specific time period. On your website, you may also make a comparison of the number of visitors to the number of repeat clients.

customers

Stock: This report presents an overview of your store’s inventories, indicating which commodities are in and out of stock.

stock

Taxes: The taxes report reveals how much revenue was earned from your store in terms of sales and state taxes. You could also look up the applicable state tax codes.

taxes

taxes report

Customized Reports

Because the Webmaster chooses which metrics are included, WooCommerce custom reports have a huge amount of customized, in-depth details. This enables you to construct one-of-a-kind analysis conclusions depending on the precise facts you wish to categorize and measure.

Data analysis for the following items can be included in custom reports:

Shipping: Compare the amount you pay for shipping to the amount consumers pay for shipment.

Coupons: Examine the most popular coupons and the amounts saved and received as a result of these offers.

Category Report: The sales and performance parameters for each product category are separated in this report.

Country and State Report: You can create a report with information regarding performance for certain states or countries to which you deliver.

Tax and Refund Report: For accounting reasons, get example computations of crucial tax and refund details.

Daily, Monthly, and Yearly Summary: View detailed reports depending on pre-determined timelines.

Sold and Unsold Products: Show the difference between the total cost of sold and unsold products.

Top Rated Products: If your website has a rating element, you can take a look at a summary of the results in this report.

To create WooCommerce custom reports, you will need to use plugins to gather, store, and arrange the information you will need for your research.

How to Create a WooCommerce Custom Report

1. Creating a WooCommerce Custom Report by Using Code

We will need to add the WC Admin Report class from the start. The class-wc-admin-report.php file, which is displayed on the first line in the code following, can be used to accomplish this.

In WooCommerce Reports, we will also need to build a “Sales By Country” page underneath the “Orders” section. We will utilize the woocommerce_admin_reports filter to do this, as can be seen here.


<?php

include_once(WC()->plugin_path().'/includes/admin/reports/class-wc-admin-report.php');

add_filter( 'woocommerce_admin_reports', 'my_custom_woocommerce_admin_reports', 10, 1 );

function my_custom_woocommerce_admin_reports( $reports ) {

   $sales_by_country = array(

       'sales_by_country' => array(

           'title'         => 'Sales By Country',

           'description'   => '',

           'hide_title'    => true,

           'callback'      => 'sales_by_country_callback',

       ),

   );

   // This can be: orders, customers, stock, or taxes, based on where we want to insert our new reports page

   $reports['orders']['reports'] = array_merge( $reports['orders']['reports'], $sales_by_country);

   return $reports;
}
?>

$reports is an array that contains the tabs and their pages, as you can recognize in the source code. Essentially, we are placing our page into that array. You can modify the ‘orders’ section to any of the other available tabs, such as customers, stock, or taxes, or build your own.

Next, we are moving to our callback function where we create an instance of the WC_Report_Sales_By_Country class which we are going to create a bit later and we are calling it is output_report() method which displays the date filter and the table report in our case.

Next, we move to our callback function, where we make an example of the WC_Report_Sales_By_Country class, which we will construct later, and call it is output_report() method, which in our case displays the date filter and the table report.


<?php

function sales_by_country_callback() {

   $report = new WC_Report_Sales_By_Country();

   $report->output_report();

}

?>

Now let’s get down to business. We will lengthen the WC_Admin_Report class and modify the following two methods: get_main_chart() – query all finished orders for the provided date period, sort them by nation, and present the number of orders and earnings. output_report()– alter the standard date range. The rest of the overridable methods, such as the export button, may be located here.

WooCommerce displays reports for the previous month by default, however, we want to modify that to the current month. When we do not have a tailored range selected, we can achieve this by altering the $current_range to ‘month’. Last_month, year, 7day, and month are some of the other options.

We verify order data with $query_data in get_main_chart(), where we supply the names of the field we need to include, its category (post_data, meta, order_item, order_item_meta), function (SUM, COUNT, or empty), and the name is how we will refer to that column.

We are querying _billing_country, as you can see from the code.


<?php

class WC_Report_Sales_By_Country extends WC_Admin_Report {

 /**

  * Output the report.

  */

 public function output_report() {

   $ranges = array(

     'year'         => __( 'Year', 'woocommerce' ),

     'last_month'   => __( 'Last month', 'woocommerce' ),

     'month'        => __( 'This month', 'woocommerce' ),

   );

   $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : 'month';

   if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', '7day' ) ) ) {

     $current_range = 'month';

   }

   $this->check_current_range_nonce( $current_range );

   $this->calculate_current_range( $current_range );

   $hide_sidebar = true;

   include( WC()->plugin_path() . '/includes/admin/views/html-report-by-date.php' );

 }

 /**

  * Get the main chart.

  */

 public function get_main_chart() {

   global $wpdb;

   $query_data = array(

     'ID' => array(

         'type'     => 'post_data',

         'function' => 'COUNT',

         'name'     => 'total_orders',

         'distinct' => true,
     ),

     '_billing_country' => array(

         'type'      => 'meta',

         'function'  => '',

         'name'      => 'country'

     ),

     '_order_total'   => array(

         'type'      => 'meta',

         'function'  => 'SUM',

         'name'      => 'order_total'

     ),

   );

   $sales_by_country_orders = $this->get_order_report_data( array(

     'data'                  => $query_data,

     'query_type'            => 'get_results',

     'group_by'              => 'country',

     'filter_range'          => true,

     'order_types'           => wc_get_order_types( 'sales-reports' ),

     'order_status'          => array( 'completed' ),

     'parent_order_status'   => false,

   ) );

   ?>

   <table class="widefat">

     <thead>

         <tr>

             <th><strong>Country</strong></th>

             <th><strong>Number Of Orders</strong></th>

             <th><strong>Sales</strong></th>

         </tr>

     </thead>

     <tbody>

         <?php foreach( $sales_by_country_orders as $order ) {

         ?>

         <tr>

             <td><?php echo WC()->countries->countries[$order->country]; ?></td>

             <td><?php echo $order->total_orders; ?></td>

             <td><?php echo wc_price($order->order_total); ?></td>

         </tr>

         <?php } ?>

     </tbody>

   </table>

   <?php

 }

}

?>

2. Creating a WooCommerce Custom Report by Using a Plugin

Establishing a Custom Report with Product Sales Report Pro

Step 1: Filtering of Order

The order term (choose from 10 pre-set ranges or make a new range), the status (choose from 7 alternatives), specific fields (pick from 8 equations and specify the value), and the user’s role are all available on the Order Filtering section.

filtering of order

Step 2: Filtering of Products

Select items, restrict by tags, constrain by fields, include or omit products depending on different statuses, including delivery, and include refunds using the Product Filtering section.

product filtering

Step 3: Sorting and Gathering

Group by and sort by options are available on the Grouping and Sorting section. None, order, or order line item can be used to group items. Sorting options include ID, SKU, name, amount, and gross sales.

sorting and gathering

Step 4: Report Sections

The Report Fields option allows you to customize which fields appear on the report. It includes the default fields, which you can remove or add as needed. The names that appear on the report could also be changed. I’d like to see a drag-and-drop option so they can be simply reconfigured.

report sections

Step 5: Formatting and Exhibiting

You can restrict the number of items to exhibit on the Display and Format section, include the title, header, totals, and quantities, and set the format (from five options) and file name. Some of these areas are constantly changing.

formatting and exhibiting

Step 6: Advanced Settings

Set a time limit for how long the report can operate, deactivate object caching, allow bug mode, and contribute your own CSS to the Advanced tab.

advanced settings

4 WooCommerce Custom Reports Plugins

1. Product Sales Report for WooCommerce

Product Sales Report for WooCommerce is a fantastic and easy-to-use alternative. It has over 9,000 active installs and is suitable with WordPress 3.5 or above. Website owners can utilize the Product Sales Report to immediately summarize individual goods or categories depending on date ranges and sales status. These reports are available in XLSX, XLS, and HTML formats, making them simple to download, share, and transmit.

product sales report for woocommerce

Outstanding features:

  • Creating and distributing reports with a single click – see or export your reports with a single click
  • Filtering by date range, either using the built-in presets or entering your own start and finish dates
  • Sorting by order status - include or exclude transactions resting on their status
  • Product-specific reporting - reports for the entire store, broken down by item or by a group of items
  • Showing all versions for a product as a single line item by grouping them together

Price: The cost of this add-on ranges from $30 for a single site to $449 for unlimited subscriptions

2. Advanced Reporting for WooCommerce

Another plugin option is Advanced Reporting for WooCommerce, which provides custom sales reports with just a few simple clicks. This extension is compatible with WordPress 3.0 and up, and it has over 1,000 active installations. This is an all-in-one software that offers a variety of report alternatives. It also works with a Support Ticket System add-on to keep track of customer troubleshooting like refunds, swaps, and replacements. Users can read overviews and select specific reports by navigating via the plugin.

advanced reporting for woocommerce

Outstanding features:

  • The plugin is aligned with Phoeniixx’s Support Ticket System plugin
  • The Total Summary, Orders Placed Today, and Total Earnings are displayed
  • Displays the most popular products and categories
  • The Top Customers list is presented
  • The Top Billing Country and the Top States are shown

Price: The free version of this WooCommerce custom reporting plugin is accessible, however, the premium version costs $39 per site.

3. Advanced WooCommerce Reporting

Advanced WooCommerce Reporting is a flexible, user-friendly framework for creating nearly any type of custom report. It works with WordPress 4.0 and higher, and there are over 4,300 active installs. There is a standard license and an extended license available for a single website.

advanced woocommerce reporting

Outstanding features:

  • Grasping all of the data easily rapidly via visual reports
  • Possessing a search function for finding specific data points or things
  • All reports are available in a variety of formats for download
  • Automatic email summaries can be sent out for all reports
  • Numerous Informative Summarize Reports on a Powerful Dashboard

Price: This plugin costs $39 and comes with a variety of add-ons for specialized features like cross tab reports and more product selections

4. Advanced WooCommerce Reports

Another wonderful low-cost choice is Make Web Better’sAdvanced WooCommerce Reports. This plugin is compatible with the most recent version of WordPress and allows for up to 25 sites to be licensed. This plugin also includes a mobile version that allows you to keep track of important data while on the go.

advanced woocommerce reports

Outstanding features:

  • Providing an overview of crucial data via the summary section
  • Allow choosing the kind of info to include in the report for a tabular summary
  • Make Your Own Reports
  • Reports should be sent via email.
  • Reports are shown graphically.

Price: The plugin costs as little as $18 for a single site or as much as $329 for 25 sites per year

Final words

Finally, we hope that our post WooCommerce Custom Reports: An Ultimate Guide has been helpful in improving your online business process. More than that, we would like to share our business tips as well as possible remedies, so you can see that running an internet business is not too difficult, and you may explore a wide choice of shop page extensions like WooCommerce to solve your website’s problem.

In addition, the only way to establish a strong e-commerce business is to have control over the data you need to make informed decisions. Without reliable data, it is practically difficult to ascertain efficient sales and business plans - yet default reports can not provide nearly enough. We sincerely hope that this article has aided your online business in some way. Furthermore, we hope that you will be able to choose the best path to follow in the post.


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.