Automattic\WooCommerce\Admin\Notes

Notes::unsnooze_notes()public staticWC 1.0

Clear note snooze status if the reminder date has been reached.

Метод класса: Notes{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = Notes::unsnooze_notes();

Код Notes::unsnooze_notes() WC 8.7.0

public static function unsnooze_notes() {
	$data_store = self::load_data_store();
	$raw_notes  = $data_store->get_notes(
		array(
			'status' => array( Note::E_WC_ADMIN_NOTE_SNOOZED ),
		)
	);
	$now        = new \DateTime();

	foreach ( $raw_notes as $raw_note ) {
		$note = self::get_note( $raw_note->note_id );
		if ( false === $note ) {
			continue;
		}

		$date_reminder = $note->get_date_reminder( 'edit' );

		if ( $date_reminder < $now ) {
			$note->set_status( Note::E_WC_ADMIN_NOTE_UNACTIONED );
			$note->set_date_reminder( null );
			$note->save();
		}
	}
}