WC_Product_CSV_Exporter::prepare_downloads_for_export()
Export downloads.
Method of the class: WC_Product_CSV_Exporter{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_downloads_for_export( $product, $row );
- $product(WC_Product) (required)
- Product being exported.
- $row(array) (required) (passed by reference — &)
- Row being exported.
Changelog
Since 3.1.0 | Introduced. |
WC_Product_CSV_Exporter::prepare_downloads_for_export() WC Product CSV Exporter::prepare downloads for export code WC 9.4.2
protected function prepare_downloads_for_export( $product, &$row ) { if ( $product->is_downloadable() && $this->is_column_exporting( 'downloads' ) ) { $downloads = $product->get_downloads( 'edit' ); if ( $downloads ) { $i = 1; foreach ( $downloads as $download ) { /* translators: %s: download number */ $this->column_names[ 'downloads:id' . $i ] = sprintf( __( 'Download %d ID', 'woocommerce' ), $i ); /* translators: %s: download number */ $this->column_names[ 'downloads:name' . $i ] = sprintf( __( 'Download %d name', 'woocommerce' ), $i ); /* translators: %s: download number */ $this->column_names[ 'downloads:url' . $i ] = sprintf( __( 'Download %d URL', 'woocommerce' ), $i ); $row[ 'downloads:id' . $i ] = $download->get_id(); $row[ 'downloads:name' . $i ] = $download->get_name(); $row[ 'downloads:url' . $i ] = $download->get_file(); $i++; } } } }