WC_Product::get_file( string $download_id = '' )

Get a file by $download_id.


Description Description


Parameters Parameters

$download_id

(string) (Optional) file identifier.

Default value: ''


Top ↑

Return Return

(array|false) if not found


Top ↑

Source Source

File: includes/abstracts/abstract-wc-product.php

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.