WordPress at Your Fingertips
function is not described

WC_WCCOM_Site_Installer::move_product() private WC 3.7.0

Move product to plugins directory.

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

No Hooks.

Return

Array|\WP_Error.

Usage

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

Changelog

Since 3.7.0 Introduced.

Code of WC_WCCOM_Site_Installer::move_product() WC 5.6.0

private static function move_product( $product_id, $upgrader ) {
	$steps = self::get_state( 'steps' );
	if ( empty( $steps[ $product_id ]['unpacked_path'] ) ) {
		return new WP_Error( 'missing_unpacked_path', __( 'Could not find unpacked path.', 'woocommerce' ) );
	}

	$destination = 'plugin' === $steps[ $product_id ]['product_type']
		? WP_PLUGIN_DIR
		: get_theme_root();

	$package = array(
		'source'        => $steps[ $product_id ]['unpacked_path'],
		'destination'   => $destination,
		'clear_working' => true,
		'hook_extra'    => array(
			'type'   => $steps[ $product_id ]['product_type'],
			'action' => 'install',
		),
	);

	$result = $upgrader->install_package( $package );

	/**
	 * If install package returns error 'folder_exists' threat as success.
	 */
	if ( is_wp_error( $result ) && array_key_exists( self::$folder_exists, $result->errors ) ) {
		return array(
			self::$folder_exists => true,
			'destination'        => $result->error_data[ self::$folder_exists ],
		);
	}
	return $result;
}