WC_Shortcode_My_Account::my_account_add_notices()
Add notices to the my account page.
Historically a filter has existed to render a message above the my account page content while the user is logged out. See woocommerce_my_account_message.
Method of the class: WC_Shortcode_My_Account{}
Hooks from the method
Return
null
. Nothing (null).
Usage
$result = WC_Shortcode_My_Account::my_account_add_notices();
WC_Shortcode_My_Account::my_account_add_notices() WC Shortcode My Account::my account add notices code WC 9.4.2
private static function my_account_add_notices() { global $wp; if ( ! is_user_logged_in() ) { /** * Filters the message shown on the 'my account' page when the user is not logged in. * * @since 2.6.0 */ $message = apply_filters( 'woocommerce_my_account_message', '' ); if ( ! empty( $message ) ) { wc_add_notice( $message ); } } // After password reset, add confirmation message. if ( ! empty( $_GET['password-reset'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended wc_add_notice( __( 'Your password has been reset successfully.', 'woocommerce' ) ); } // After logging out without a nonce, add confirmation message. if ( isset( $wp->query_vars['customer-logout'] ) && is_user_logged_in() ) { /* translators: %s: logout url */ wc_add_notice( sprintf( __( 'Are you sure you want to log out? <a href="%s">Confirm and log out</a>', 'woocommerce' ), wc_logout_url() ) ); } }