WC_Product::get_file()
Get a file by $download_id.
Method of the class: WC_Product{}
Hooks from the method
Return
Array|false
. if not found
Usage
$WC_Product = new WC_Product(); $WC_Product->get_file( $download_id );
- $download_id(string)
- file identifier.
Default: ''
WC_Product::get_file() WC Product::get file code WC 9.2.3
public function get_file( $download_id = '' ) { $files = $this->get_downloads(); if ( '' === $download_id ) { $file = count( $files ) ? current( $files ) : false; } elseif ( isset( $files[ $download_id ] ) ) { $file = $files[ $download_id ]; } else { $file = false; } return apply_filters( 'woocommerce_product_file', $file, $this, $download_id ); }