Automattic\WooCommerce\Admin\Features\OnboardingTasks

Task::snooze()publicWC 1.0

Deprecated from version 7.2.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Snooze the task.

Method of the class: Task{}

No Hooks.

Return

true|false.

Usage

$Task = new Task();
$Task->snooze( $duration );
$duration(string)
Duration to snooze. day|hour|week.
Default: 'day'

Changelog

Deprecated since 7.2.0

Task::snooze() code WC 8.6.1

public function snooze( $duration = 'day' ) {
	wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.2.0' );

	if ( ! $this->is_snoozeable() ) {
		return false;
	}

	$snoozed                    = get_option( self::SNOOZED_OPTION, array() );
	$snoozed_until              = $this->duration_to_ms[ $duration ] + ( time() * 1000 );
	$snoozed[ $this->get_id() ] = $snoozed_until;
	$update                     = update_option( self::SNOOZED_OPTION, $snoozed );

	if ( $update ) {
		if ( $update ) {
			$this->record_tracks_event( 'remindmelater_task', array( 'task_name' => $this->get_id() ) );
		}
	}

	return $update;
}