WC_Admin_Exporters::download_export_file
Serve the generated file.
Method of the class: WC_Admin_Exporters{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Admin_Exporters = new WC_Admin_Exporters(); $WC_Admin_Exporters->download_export_file();
WC_Admin_Exporters::download_export_file() WC Admin Exporters::download export file code WC 10.6.2
public function download_export_file() {
if ( isset( $_GET['action'], $_GET['nonce'] ) && wp_verify_nonce( wp_unslash( $_GET['nonce'] ), 'product-csv' ) && 'download_product_csv' === wp_unslash( $_GET['action'] ) ) { // WPCS: input var ok, sanitization ok.
include_once WC_ABSPATH . 'includes/export/class-wc-product-csv-exporter.php';
$exporter = new WC_Product_CSV_Exporter();
if ( ! empty( $_GET['filename'] ) ) { // WPCS: input var ok.
$exporter->set_filename( wp_unslash( $_GET['filename'] ) ); // WPCS: input var ok, sanitization ok.
}
$exporter->export();
}
}