WC_WCCOM_Site_Installer::schedule_install()
Schedule installing given list of products.
Method of the class: WC_WCCOM_Site_Installer{}
No Hooks.
Return
Array
. State.
Usage
$result = WC_WCCOM_Site_Installer::schedule_install( $products );
- $products(array) (required)
- Array of products where key is product ID and element is install args.
Changelog
Since 3.7.0 | Introduced. |
WC_WCCOM_Site_Installer::schedule_install() WC WCCOM Site Installer::schedule install code WC 7.7.0
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(); }