WC_WCCOM_Site_Installation_Step_Get_Product_Info::get_wccom_download_url
Get download URL for wccom product.
Method of the class: WC_WCCOM_Site_Installation_Step_Get_Product_Info{}
No Hooks.
Returns
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() WC WCCOM Site Installation Step Get Product Info::get wccom download url code WC 10.5.0
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'];
}