WordPress at Your Fingertips
function is not described

WC_Product::get_file() public WC 1.0

Get a file by $download_id.

{} It's a 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: ''

Code of WC_Product::get_file() WC 5.8.0

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 );
}