Automattic\WooCommerce\Admin\API\Reports\Coupons

Controller::prepare_item_for_export()publicWC 1.0

Get the column values for export.

{} Это метод класса: Controller{}

Возвращает

Массив. Key value pair of Column ID => Row Value.

Использование

$Controller = new Controller();
$Controller->prepare_item_for_export( $item );
$item(массив) (обязательный)
Single report item/row.

Код Controller::prepare_item_for_export() WC 6.9.4

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
	);
}