Automattic\WooCommerce\Internal\Admin\Schedulers

OrdersScheduler::schedule_recurring_batch_processorpublic staticWC 1.0

Schedule recurring batch processor for order imports.

Method of the class: OrdersScheduler{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = OrdersScheduler::schedule_recurring_batch_processor();

OrdersScheduler::schedule_recurring_batch_processor() code WC 10.5.0

public static function schedule_recurring_batch_processor() {
	$action_hook = self::get_action( self::PROCESS_PENDING_ORDERS_BATCH_ACTION );
	// The most efficient way to check for an existing action is to use `as_has_scheduled_action`, but in unusual
	// cases where another plugin has loaded a very old version of Action Scheduler, it may not be available to us.
	$has_scheduled_action = function_exists( 'as_has_scheduled_action' ) ? 'as_has_scheduled_action' : 'as_next_scheduled_action';
	if ( call_user_func( $has_scheduled_action, $action_hook ) ) {
		return;
	}

	$interval = self::get_import_interval();

	as_schedule_recurring_action( time(), $interval, $action_hook, array(), static::$group, true );
}