Automattic\WooCommerce\Blocks\Patterns

PTKPatternsStore::schedule_action_if_not_pendingprivateWC 1.0

Schedule an action if it's not already pending.

Method of the class: PTKPatternsStore{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->schedule_action_if_not_pending( $action );
$action(string) (required)
The action name to schedule.

PTKPatternsStore::schedule_action_if_not_pending() code WC 10.7.0

private function schedule_action_if_not_pending( $action ) {
	if ( as_has_scheduled_action( $action, array(), 'woocommerce' ) ) {
		return;
	}

	as_schedule_recurring_action( time(), DAY_IN_SECONDS, $action, array(), 'woocommerce' );
}