WC_REST_Report_Orders_Totals_Controller::get_reports
Get reports list.
Метод класса: WC_REST_Report_Orders_Totals_Controller{}
Хуков нет.
Возвращает
Массив.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_reports();
Список изменений
| С версии 3.5.0 | Введена. |
Код WC_REST_Report_Orders_Totals_Controller::get_reports() WC REST Report Orders Totals Controller::get reports WC 10.7.0
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php
protected function get_reports() {
$totals = OrderUtil::get_count_for_type( 'shop_order' );
$data = array();
foreach ( wc_get_order_statuses() as $slug => $name ) {
if ( ! array_key_exists( $slug, $totals ) ) {
continue;
}
$data[] = array(
'slug' => str_replace( 'wc-', '', $slug ),
'name' => $name,
'total' => (int) $totals[ $slug ],
);
}
return $data;
}