WordPress at Your Fingertips
function is not described

WC_REST_Report_Orders_Totals_Controller::get_reports() protected WC 3.5.0

Get reports list.

{} It's a method of the class: WC_REST_Report_Orders_Totals_Controller{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_reports();

Changelog

Since 3.5.0 Introduced.

Code of WC_REST_Report_Orders_Totals_Controller::get_reports() WC 5.7.1

protected function get_reports() {
	$totals = wp_count_posts( 'shop_order' );
	$data   = array();

	foreach ( wc_get_order_statuses() as $slug => $name ) {
		if ( ! isset( $totals->$slug ) ) {
			continue;
		}

		$data[] = array(
			'slug'  => str_replace( 'wc-', '', $slug ),
			'name'  => $name,
			'total' => (int) $totals->$slug,
		);
	}

	return $data;
}