WooCommerce Code Reference

WC_Admin_Dashboard
in package

WC_Admin_Dashboard Class.

Table of Contents

__construct()  : mixed
Hook in tabs.
init()  : mixed
Init dashboard widgets.
network_orders()  : mixed
Network orders widget.
recent_reviews()  : mixed
Recent reviews widget.
register_network_order_widget()  : mixed
Register the network order dashboard widget.
status_widget()  : mixed
Show status widget.
get_sales_sparkline()  : array<string|int, mixed>
Prepares the data for a sparkline to show sales in the last X days.
get_top_seller()  : object
Get top seller from DB.
get_wc_admin_performance_data()  : stdClass|WP_Error|WP_REST_Response
Gets the sales performance data from the new WooAdmin store.
sales_sparkline_markup()  : string
Prepares the markup for a sparkline to show sales in the last X days with the given data.
should_display_widget()  : bool
Check to see if we should display the widget.
status_widget_order_rows()  : mixed
Show order data is status widget.
status_widget_stock_rows()  : mixed
Show stock data is status widget.

Methods

get_sales_sparkline()

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

private get_sales_sparkline([int $id = '' ][, int $days = 7 ][, string $type = 'sales' ]) : array<string|int, mixed>
Parameters
$id : int = ''

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

$days : int = 7

Days of stats to get. Default to 7 days.

$type : string = 'sales'

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

Return values
array<string|int, mixed>

get_wc_admin_performance_data()

Gets the sales performance data from the new WooAdmin store.

private get_wc_admin_performance_data() : stdClass|WP_Error|WP_REST_Response
Return values
stdClass|WP_Error|WP_REST_Response

sales_sparkline_markup()

Prepares the markup for a sparkline to show sales in the last X days with the given data.

private sales_sparkline_markup(string $type, int $days, int $total, array<string|int, mixed> $sparkline_data) : string
Parameters
$type : string

Type of sparkline to form the markup.

$days : int

Days of stats to form the markup.

$total : int

Total income or items sold to form the markup.

$sparkline_data : array<string|int, mixed>

Sparkline data to form the markup.

Return values
string

status_widget_stock_rows()

Show stock data is status widget.

private status_widget_stock_rows(string $lowstock_link, string $outofstock_link) : mixed
Parameters
$lowstock_link : string

Low stock link.

$outofstock_link : string

Out of stock link.

Return values
mixed