WC_WCCOM_Site_Installation_Step_Get_Product_Info::get_wccom_download_url()protectedWC 1.0

Get download URL for wccom product.

Method of the class: WC_WCCOM_Site_Installation_Step_Get_Product_Info{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_wccom_download_url( $product_id );
$product_id(int) (required)
Product ID.

WC_WCCOM_Site_Installation_Step_Get_Product_Info::get_wccom_download_url() code WC 9.3.3

protected function get_wccom_download_url( $product_id ) {
	WC_Helper::_flush_subscriptions_cache();

	if ( ! WC_Helper::has_product_subscription( $product_id ) ) {
		throw new Installer_Error( Installer_Error_Codes::WCCOM_PRODUCT_MISSING_SUBSCRIPTION );
	}

	// Retrieve download URL for non-wporg product.
	WC_Helper_Updater::flush_updates_cache();
	$updates = WC_Helper_Updater::get_update_data();

	if ( empty( $updates[ $product_id ]['package'] ) ) {
		throw new Installer_Error( Installer_Error_Codes::WCCOM_PRODUCT_MISSING_PACKAGE );
	}

	return $updates[ $product_id ]['package'];
}