Automattic\WooCommerce\Admin\Notes

Notes::unsnooze_notes()public staticWC 1.0

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

Method of the class: Notes{}

No Hooks.

Return

null. Nothing.

Usage

$result = Notes::unsnooze_notes();

Notes::unsnooze_notes() code WC 7.1.1

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();
		}
	}
}