Automattic\WooCommerce\Admin\Notes
Notes::unsnooze_notes() public WC 1.0
Clear note snooze status if the reminder date has been reached.
{} Это метод класса: Notes{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$result = Notes::unsnooze_notes();
Код Notes::unsnooze_notes() Notes::unsnooze notes WC 5.0.0
public static function unsnooze_notes() {
$data_store = \WC_Data_Store::load( 'admin-note' );
$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();
}
}
}