WC_WCCOM_Site_Installer::schedule_install( array $products )

Schedule installing given list of products.


Description Description


Parameters Parameters

$products

(Required) Array of products where key is product ID and element is install args.


Top ↑

Return Return

(array) State.


Top ↑

Source Source

File: includes/wccom-site/class-wc-wccom-site-installer.php

	public static function schedule_install( $products ) {
		$state  = self::get_state();
		$status = ! empty( $state['status'] ) ? $state['status'] : '';
		if ( 'in-progress' === $status ) {
			return $state;
		}
		self::update_state( 'status', 'in-progress' );

		$steps = array_fill_keys( array_keys( $products ), self::$default_step_state );
		self::update_state( 'steps', $steps );

		self::update_state( 'current_step', null );

		$args = array(
			'products' => $products,
		);

		// Clear the cache of customer's subscription before asking for them.
		// Thus, they will be re-fetched from WooCommerce.com after a purchase.
		WC_Helper::_flush_subscriptions_cache();

		WC()->queue()->cancel_all( 'woocommerce_wccom_install_products', $args );
		WC()->queue()->add( 'woocommerce_wccom_install_products', $args );

		return self::get_state();
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.