WordPress at a glance
function is not described

WC_API_XML_Handler::format_sales_report_data() public WC 2.1

Adjust the sales report array format to change totals keyed with the sales date to become an attribute for the totals element instead

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

No Hooks.

Return

Array.

Usage

$WC_API_XML_Handler = new WC_API_XML_Handler();
$WC_API_XML_Handler->format_sales_report_data( $data );
$data(array) (required)
-

Changelog

Since 2.1 Introduced.

Code of WC_API_XML_Handler::format_sales_report_data() WC 5.0.0

<?php
public function format_sales_report_data( $data ) {

	if ( ! empty( $data['totals'] ) ) {

		foreach ( $data['totals'] as $date => $totals ) {

			unset( $data['totals'][ $date ] );

			$data['totals'][] = array_merge( array( '@attributes' => array( 'date' => $date ) ), $totals );
		}
	}

	return $data;
}