Automattic\WooCommerce\Admin
ReportExporter::email_report_download_link
Process a report export email action.
Method of the class: ReportExporter{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = ReportExporter::email_report_download_link( $user_id, $export_id, $report_type );
- $user_id(int) (required)
- User ID that requested the email.
- $export_id(string) (required)
- Unique ID for report (timestamp expected).
- $report_type(string) (required)
- Report type. E.g. 'customers'.
ReportExporter::email_report_download_link() ReportExporter::email report download link code WC 10.3.6
public static function email_report_download_link( $user_id, $export_id, $report_type ) {
$percent_complete = self::get_export_percentage_complete( $report_type, $export_id );
if ( 100 === $percent_complete ) {
$query_args = array(
'action' => self::DOWNLOAD_EXPORT_ACTION,
'filename' => "wc-{$report_type}-report-export-{$export_id}",
);
$download_url = add_query_arg( $query_args, admin_url() );
\WC_Emails::instance();
$email = new ReportCSVEmail();
$email->trigger( $user_id, $report_type, $download_url );
}
}