WC_Notes_Refund_Returns::possibly_add_note
Maybe add a note to the inbox.
Method of the class: WC_Notes_Refund_Returns{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Notes_Refund_Returns::possibly_add_note( $page_id );
- $page_id(int) (required)
- The ID of the page.
WC_Notes_Refund_Returns::possibly_add_note() WC Notes Refund Returns::possibly add note code WC 10.5.0
public static function possibly_add_note( $page_id ) {
if ( ! WC()->is_wc_admin_active() ) {
return;
}
$data_store = \WC_Data_Store::load( 'admin-note' );
// Do we already have this note?
$note_id = $data_store->get_notes_with_name( self::NOTE_NAME );
if ( ! empty( $note_id ) ) {
$note = new Note( $note_id );
if ( false !== $note || $note::E_WC_ADMIN_NOTE_ACTIONED === $note->get_status() ) {
// note actioned -> don't show it.
return;
}
}
// Add note.
$note = self::get_note( $page_id );
$note->save();
delete_option( 'woocommerce_refund_returns_page_created' );
}