WC_WCCOM_Site_Installer::download_product()private staticWC 3.7.0

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

Метод класса: WC_WCCOM_Site_Installer{}

Хуков нет.




$result = WC_WCCOM_Site_Installer::download_product( $product_id, $upgrader );
$product_id(int) (обязательный)
Product ID.
$upgrader(\WP_Upgrader) (обязательный)
Core class to handle installation.

Список изменений

С версии 3.7.0 Введена.

Код WC_WCCOM_Site_Installer::download_product() WC 7.3.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'] );