Automattic\WooCommerce\Admin\Notes

Note::add_action()publicWC 1.0

Add an action to the note

Method of the class: Note{}

No Hooks.

Return

null. Nothing (null).

Usage

$Note = new Note();
$Note->add_action(;

Note::add_action() code WC 8.7.0

public function add_action(
	$name,
	$label,
	$url = '',
	$status = self::E_WC_ADMIN_NOTE_ACTIONED,
	$primary = false,
	$actioned_text = ''
) {
	$name          = wc_clean( $name );
	$label         = wc_clean( $label );
	$query         = esc_url_raw( $url );
	$status        = wc_clean( $status );
	$actioned_text = wc_clean( $actioned_text );

	if ( empty( $name ) ) {
		$this->error( 'admin_note_invalid_data', __( 'The admin note action name prop cannot be empty.', 'woocommerce' ) );
	}

	if ( empty( $label ) ) {
		$this->error( 'admin_note_invalid_data', __( 'The admin note action label prop cannot be empty.', 'woocommerce' ) );
	}

	$action = array(
		'name'          => $name,
		'label'         => $label,
		'query'         => $query,
		'status'        => $status,
		'actioned_text' => $actioned_text,
		'nonce_name'    => null,
		'nonce_action'  => null,
	);

	$note_actions   = $this->get_prop( 'actions', 'edit' );
	$note_actions[] = (object) $action;
	$this->set_prop( 'actions', $note_actions );
}