WC_Notes_Refund_Returns::possibly_add_note()public staticWC 1.0

Maybe add a note to the inbox.

Метод класса: WC_Notes_Refund_Returns{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WC_Notes_Refund_Returns::possibly_add_note( $page_id );
$page_id(int) (обязательный)
The ID of the page.

Код WC_Notes_Refund_Returns::possibly_add_note() WC 9.4.2

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