Automattic\WooCommerce\Admin\API\Reports\Coupons

Controller::prepare_item_for_export()publicWC 1.0

Get the column values for export.

Method of the class: Controller{}

Return

Array. Key value pair of Column ID => Row Value.

Usage

$Controller = new Controller();
$Controller->prepare_item_for_export( $item );
$item(array) (required)
Single report item/row.

Controller::prepare_item_for_export() code WC 7.3.0

public function prepare_item_for_export( $item ) {
	$date_expires = empty( $item['extended_info']['date_expires'] )
		? __( 'N/A', 'woocommerce' )
		: $item['extended_info']['date_expires'];

	$export_item = array(
		'code'         => $item['extended_info']['code'],
		'orders_count' => $item['orders_count'],
		'amount'       => $item['amount'],
		'created'      => $item['extended_info']['date_created'],
		'expires'      => $date_expires,
		'type'         => $item['extended_info']['discount_type'],
	);

	/**
	 * Filter to prepare extra columns in the export item for the coupons
	 * report.
	 *
	 * @since 1.6.0
	 */
	return apply_filters(
		'woocommerce_report_coupons_prepare_export_item',
		$export_item,
		$item
	);
}