WC_API_XML_Handler::format_sales_report_data()
Adjust the sales report array format to change totals keyed with the sales date to become an attribute for the totals element instead
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. |
WC_API_XML_Handler::format_sales_report_data() WC API XML Handler::format sales report data code WC 7.7.0
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; }