WC_Product::has_file()publicWC 1.6.2

Check if downloadable product has a file attached.

{} It's a method of the class: WC_Product{}

No Hooks.

Return

true|false. Whether downloadable product has a file attached.

Usage

$WC_Product = new WC_Product();
$WC_Product->has_file( $download_id );
$download_id(string)
file identifier.
Default: ''

Changelog

Since 1.6.2 Introduced.

Code of WC_Product::has_file() WC 6.8.2

public function has_file( $download_id = '' ) {
	return $this->is_downloadable() && $this->get_file( $download_id );
}