Automattic\WooCommerce\Admin\Notes
Notes::unsnooze_notes
Clear note snooze status if the reminder date has been reached.
Method of the class: Notes{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = Notes::unsnooze_notes();
Notes::unsnooze_notes() Notes::unsnooze notes code WC 10.8.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();
}
}
}