Automattic\WooCommerce\Admin

ReportCSVExporter::get_download_filename │ public │ WC 11.2.0

Get the name the export is downloaded as.

The stored file keeps get_filename(), which only has to identify the export.

Method of the class: ReportCSVExporter{}

No Hooks.

Returns

string.

Usage

$ReportCSVExporter = new ReportCSVExporter();
$ReportCSVExporter->get_download_filename();

Changelog

Since 11.2.0 Introduced.

ReportCSVExporter::get_download_filename() code WC 11.2.1

public function get_download_filename() {
	$filename = $this->get_filename();

	if ( '' === $this->download_suffix ) {
		return $filename;
	}

	// Stripped and restored the way set_filename() does it, so the name keeps a single .csv.
	return sanitize_file_name( str_replace( '.csv', '', $filename ) . '-' . $this->download_suffix . '.csv' );
}