Automattic\WooCommerce\Admin
ReportExporter::get_download_url
Get the URL a finished report export is downloaded from.
Method of the class: ReportExporter{}
No Hooks.
Returns
string.
Usage
$result = ReportExporter::get_download_url( $report_type, $export_id, $report_args );
- $report_type(string) (required)
- Report type. E.g.
'customers'. - $export_id(string) (required)
- Unique ID for report (timestamp expected).
- $report_args(array)
- Report parameters the export was queued with. When they name a date range, the link carries it so the download is named after it.
Default:array()
Changelog
| Since 11.2.0 | Introduced. |
ReportExporter::get_download_url() ReportExporter::get download url code WC 11.2.1
public static function get_download_url( $report_type, $export_id, $report_args = array() ) {
$query_args = array(
'action' => self::DOWNLOAD_EXPORT_ACTION,
'filename' => self::get_export_filename( $report_type, $export_id ),
);
$date_range = self::get_export_date_range( $report_args );
if ( $date_range ) {
$query_args['date_range'] = $date_range['after'] . '-to-' . $date_range['before'];
}
return add_query_arg( $query_args, admin_url() );
}