WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\API\Reports\Export

Controller::export_items() public WC 1.0

Export data based on user request params.

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

Хуков нет.

Возвращает

WP_Error/WP_REST_Response.

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

$Controller = new Controller();
$Controller->export_items( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Код Controller::export_items() WC 4.7.1

<?php
public function export_items( $request ) {
	$report_type = $request['type'];
	$report_args = empty( $request['report_args'] ) ? array() : $request['report_args'];
	$send_email  = isset( $request['email'] ) ? $request['email'] : false;
	$export_id   = str_replace( '.', '', microtime( true ) );
	$total_rows  = ReportExporter::queue_report_export( $export_id, $report_type, $report_args, $send_email );

	if ( 0 === $total_rows ) {
		return rest_ensure_response(
			array(
				'message' => __( 'There is no data to export for the given request.', 'woocommerce' ),
			)
		);
	}

	ReportExporter::update_export_percentage_complete( $report_type, $export_id, 0 );

	$response = rest_ensure_response(
		array(
			'message'   => __( 'Your report file is being generated.', 'woocommerce' ),
			'export_id' => $export_id,
		)
	);

	// Include a link to the export status endpoint.
	$response->add_links(
		array(
			'status' => array(
				'href' => rest_url( sprintf( '%s/reports/%s/export/%s/status', $this->namespace, $report_type, $export_id ) ),
			),
		)
	);

	$data = $this->prepare_response_for_collection( $response );

	return rest_ensure_response( $data );
}