WC_Order_Item_Product::get_item_download_url()publicWC 1.0

Get the Download URL.

Method of the class: WC_Order_Item_Product{}

No Hooks.

Return

String.

Usage

$WC_Order_Item_Product = new WC_Order_Item_Product();
$WC_Order_Item_Product->get_item_download_url( $download_id );
$download_id(int) (required)
Download ID.

WC_Order_Item_Product::get_item_download_url() code WC 9.4.2

public function get_item_download_url( $download_id ) {
	$order = $this->get_order();

	return $order ? add_query_arg(
		array(
			'download_file' => $this->get_variation_id() ? $this->get_variation_id() : $this->get_product_id(),
			'order'         => $order->get_order_key(),
			'email'         => rawurlencode( $order->get_billing_email() ),
			'key'           => $download_id,
		),
		trailingslashit( home_url() )
	) : '';
}