wc_print_notice() – Print a single notice immediately.

Description

Print a single notice immediately.

Usage

wc_print_notice( $message, $notice_type, $data );

Parameters

$message
( string ) required – The text to display in the notice.
$notice_type
( string ) optional default: success – Optional. The singular name of the notice type – either error, success or notice.
$data
( array ) optional – Optional notice data. @since 3.9.0.

Returns

void

Source

File name: woocommerce/includes/wc-notice-functions.php


Lines:

1 to 21 of 21
function wc_print_notice( $message, $notice_type = 'success', $data = array() ) {
  if ( 'success' === $notice_type ) {
    $message = apply_filters( 'woocommerce_add_message', $message );
  }

  $message = apply_filters( 'woocommerce_add_' . $notice_type, $message );

  wc_get_template(
    "notices/{$notice_type}.php",
    array(
      'messages' => array( $message ), // @deprecated 3.9.0
      'notices'  => array(
        array(
          'notice' => $message,
          'data'   => $data,
        ),
      ),
    )
  );
}
 

 View on GitHub View on Trac

Invoked by

    API Letters: ,,