Automattic\WooCommerce\Blocks\Domain\Services

DraftOrders::maybe_create_cronjobsprotectedWC 1.0

Maybe create cron events.

Method of the class: DraftOrders{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->maybe_create_cronjobs();

DraftOrders::maybe_create_cronjobs() code WC 9.9.3

protected function maybe_create_cronjobs() {
	$has_scheduled_action = function_exists( 'as_has_scheduled_action' ) ? 'as_has_scheduled_action' : 'as_next_scheduled_action';
	if ( false === call_user_func( $has_scheduled_action, 'woocommerce_cleanup_draft_orders' ) ) {
		as_schedule_recurring_action( strtotime( 'midnight tonight' ), DAY_IN_SECONDS, 'woocommerce_cleanup_draft_orders' );
	}
}