Automattic\WooCommerce\Admin

ReportExporter::export_report()public staticWC 1.0

Process a report export action.

Method of the class: ReportExporter{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = ReportExporter::export_report( $page_number, $export_id, $report_type, $report_args );
$page_number(int) (required)
Page number for this action.
$export_id(string) (required)
Unique ID for report (timestamp expected).
$report_type(string) (required)
Report type. E.g. 'customers'.
$report_args(array) (required)
Report parameters, passed to data query.

ReportExporter::export_report() code WC 8.7.0

public static function export_report( $page_number, $export_id, $report_type, $report_args ) {
	$report_args['page'] = $page_number;

	$exporter = new ReportCSVExporter( $report_type, $report_args );
	$exporter->set_filename( "wc-{$report_type}-report-export-{$export_id}" );
	$exporter->generate_file();

	self::update_export_percentage_complete( $report_type, $export_id, $exporter->get_percent_complete() );
}