2021 Q4 Sale BFCM – Free Users Sitewide Banner

  1. Documentation

API

Developers only …

This section is provided for WooCommerce developers who want to interact with the API. You need an advanced understanding of PHP and WordPress development. If you are not a developer but would like to find one to help with customization, select a WooExpert or Developer for assistance.

Filters ↑ Back to top

The extension provides the following filters which can be used to include order statuses in its calculations in addition to those that it uses by default. The reports all are based on orders that are either processing or completed. If you would like to include custom order statuses, you can use these filters to add them so that data from orders with those statuses is included.

  • woocommerce_sales_analysis_country_customers_table_order_status – affects the data included for the Customer Analysis report
  • woocommerce_sales_analysis_country_products_table_order_status – affects the data included for the reports Products by Country, Product Revenue and Unit Sales
  • woocommerce_sales_analysis_country_sales_table_order_status – affects the data included for the report on Sales by Country
  • woocommerce_sales_analysis_country_trend_table_order_status – affects the data included for the Order Analysis and Revenue Analysis reports

These filters all take two arguments:

  • $order_status of type string[] which receives the used order statuses
  • $table of type object which receives the instance of the table to which the filter applies

The filter implemented must return string[] with desired order statuses to be taken into account.

Example:

In this example, we add a third order status ‘building’ to the default ones used. We add the filter to all tables, so that it affects all reports.

function my_wsa_order_status( $order_status, $table ) {
    $order_status[] = 'building';
    return $order_status;
}

add_filter( 'woocommerce_sales_analysis_country_customers_table_order_status', 'my_wsa_order_status', 10, 2 );
add_filter( 'woocommerce_sales_analysis_country_products_table_order_status', 'my_wsa_order_status', 10, 2 );
add_filter( 'woocommerce_sales_analysis_country_sales_table_order_status', 'my_wsa_order_status', 10, 2 );
add_filter( 'woocommerce_sales_analysis_country_trend_table_order_status', 'my_wsa_order_status', 10, 2 );

WooCommerce - the most customizable eCommerce platform for building your online business.

  • 30 day money back guarantee
  • Support teams across the world
  • Safe & Secure online payment