WordPress at Your Fingertips
function is not described

WC_WCCOM_Site_Installer::download_product() private WC 3.7.0

Download product by its ID and returns the path of the zip package.

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

No Hooks.




$result = WC_WCCOM_Site_Installer::download_product( $product_id, $upgrader );
$product_id(int) (required)
Product ID.
$upgrader(\WP_Upgrader) (required)
Core class to handle installation.


Since 3.7.0 Introduced.

Code of WC_WCCOM_Site_Installer::download_product() WC 5.6.0

private static function download_product( $product_id, $upgrader ) {
	$steps = self::get_state( 'steps' );
	if ( empty( $steps[ $product_id ]['download_url'] ) ) {
		return new WP_Error( 'missing_download_url', __( 'Could not find download url for the product.', 'woocommerce' ) );
	return $upgrader->download_package( $steps[ $product_id ]['download_url'] );