WC_Product::get_file()publicWC 1.0

Get a file by $download_id.

Метод класса: WC_Product{}

Хуки из метода

Возвращает

Массив|false. if not found

Использование

$WC_Product = new WC_Product();
$WC_Product->get_file( $download_id );
$download_id(строка)
file identifier.
По умолчанию: ''

Код WC_Product::get_file() WC 8.7.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 );
}