WooCommerce Code Reference

Search results

WC_Report_Taxes_By_Date extends WC_Admin_Report

WC_Report_Taxes_By_Date

Extended by reports to show charts and stats in admin.

Table of Contents

$transients_to_update array
$cached_results array
$chart_interval The chart interval. int
$group_by_query Group by SQL query. string
$barwidth The bar width. int
$chart_groupby Group chart item by day or month. string
$start_date The start date of the report. int
$end_date The end date of the report. int
get_chart_legend() Get the legend for the main chart sidebar. array
get_export_button() Output an export link. mixed
output_report() Output the report. mixed
get_main_chart() Get the main chart. mixed
get_order_report_data() Get report totals such as order totals and discount amounts. mixed
add_update_transients_hook() Init the static hooks of the class. mixed
enable_big_selects() Enables big mysql selects for reports, just once for this session. mixed
get_cached_query() Get the cached query result or null if it's not in the cache. mixed
set_cached_query() Set the cached query result. mixed
maybe_update_transients() Function to update the modified transients at the end of the request. mixed
prepare_chart_data() Put data with post_date's into an array of times. array
sales_sparkline() Prepares a sparkline to show sales in the last X days. string
calculate_current_range() Get the current range and calculate the start and end dates. mixed
get_currency_tooltip() Return currency tooltip JS based on WooCommerce currency position settings. string
get_main_chart() Get the main chart. mixed
get_chart_legend() Get the legend for the main chart sidebar. array
get_chart_widgets() Get chart widgets. array
get_export_button() Get an export link if needed. mixed
output_report() Output the report. mixed
check_current_range_nonce() Check nonce for current range. mixed

Properties

Methods

get_order_report_data()

Get report totals such as order totals and discount amounts.

public get_order_report_data( [ $args : array = array() ] ) : mixed

Data example:

'_order_total' => array( 'type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales' )

Parameters
$args : array = array()
Return values
mixed

depending on query_type

add_update_transients_hook()

Init the static hooks of the class.

protected static add_update_transients_hook( ) : mixed
Return values
mixed

enable_big_selects()

Enables big mysql selects for reports, just once for this session.

protected static enable_big_selects( ) : mixed
Return values
mixed

get_cached_query()

Get the cached query result or null if it's not in the cache.

protected get_cached_query( $query_hash : string ) : mixed
Parameters
$query_hash : string

The query hash.

Return values
mixed

set_cached_query()

Set the cached query result.

protected set_cached_query( $query_hash : string , $data : mixed ) : mixed
Parameters
$query_hash : string

The query hash.

$data : mixed

The data to cache.

Return values
mixed

maybe_update_transients()

Function to update the modified transients at the end of the request.

public static maybe_update_transients( ) : mixed
Return values
mixed

prepare_chart_data()

Put data with post_date's into an array of times.

public prepare_chart_data( $data : array , $date_key : string , $data_key : string , $interval : int , $start_date : string , $group_by : string ) : array
Parameters
$data : array

array of your data

$date_key : string

key for the 'date' field. e.g. 'post_date'

$data_key : string

key for the data you are charting

$interval : int
$start_date : string
$group_by : string
Return values
array

sales_sparkline()

Prepares a sparkline to show sales in the last X days.

public sales_sparkline( [ $id : int = '' ] [, $days : int = 7 ] [, $type : string = 'sales' ] ) : string
Parameters
$id : int = ''

ID of the product to show. Blank to get all orders.

$days : int = 7

Days of stats to get.

$type : string = 'sales'

Type of sparkline to get. Ignored if ID is not set.

Return values
string

calculate_current_range()

Get the current range and calculate the start and end dates.

public calculate_current_range( $current_range : string ) : mixed
Parameters
$current_range : string
Return values
mixed

get_currency_tooltip()

Return currency tooltip JS based on WooCommerce currency position settings.

public get_currency_tooltip( ) : string
Return values
string

get_chart_legend()

Get the legend for the main chart sidebar.

public get_chart_legend( ) : array
Return values
array

get_chart_widgets()

Get chart widgets.

public get_chart_widgets( ) : array
Return values
array

get_export_button()

Get an export link if needed.

public get_export_button( ) : mixed
Return values
mixed

check_current_range_nonce()

Check nonce for current range.

public check_current_range_nonce( $current_range : string ) : mixed
Parameters
$current_range : string

Current range.

Tags
since
Return values
mixed
Back to the top