WC_Notes_Refund_Returns::possibly_add_note()public staticWC 1.0

Maybe add a note to the inbox.

Method of the class: WC_Notes_Refund_Returns{}

No Hooks.

Return

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() code WC 8.7.0

public static function possibly_add_note( $page_id ) {
	$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' );
}