diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php index caf9b9ae112be..9316e1e7a9834 100644 --- a/includes/class-wc-checkout.php +++ b/includes/class-wc-checkout.php @@ -714,7 +714,7 @@ public function process_checkout() { if ( is_ajax() ) { ob_start(); - wc_print_messages(); + wc_print_notices(); $messages = ob_get_clean(); echo '' . json_encode( diff --git a/includes/class-wc-shortcodes.php b/includes/class-wc-shortcodes.php index b224b2f2990ac..84b320bc6f52e 100644 --- a/includes/class-wc-shortcodes.php +++ b/includes/class-wc-shortcodes.php @@ -836,7 +836,7 @@ public static function product_page( $atts ) { public static function shop_messages() { ob_start(); - wc_print_messages(); + wc_print_notices(); return '
' . ob_get_clean() . '
'; } diff --git a/includes/shortcodes/class-wc-shortcode-checkout.php b/includes/shortcodes/class-wc-shortcode-checkout.php index 5c52cca03784d..7e8b4eac3a558 100644 --- a/includes/shortcodes/class-wc-shortcode-checkout.php +++ b/includes/shortcodes/class-wc-shortcode-checkout.php @@ -71,7 +71,7 @@ private static function order_pay( $order_id ) { do_action( 'before_woocommerce_pay' ); - wc_print_messages(); + wc_print_notices(); $order_id = absint( $order_id ); @@ -168,7 +168,7 @@ private static function order_pay( $order_id ) { wc_add_notice( __( 'Invalid order.', 'woocommerce' ), 'error' ); } - wc_print_messages(); + wc_print_notices(); do_action( 'after_woocommerce_pay' ); } @@ -179,7 +179,7 @@ private static function order_pay( $order_id ) { private static function order_received( $order_id = 0 ) { global $woocommerce; - wc_print_messages(); + wc_print_notices(); $order = false; @@ -206,7 +206,7 @@ private static function checkout() { global $woocommerce; // Show non-cart errors - wc_print_messages(); + wc_print_notices(); // Check cart has contents if ( sizeof( $woocommerce->cart->get_cart() ) == 0 ) diff --git a/includes/wc-deprecated-functions.php b/includes/wc-deprecated-functions.php index 9415e09fb955f..3470676a41c2d 100644 --- a/includes/wc-deprecated-functions.php +++ b/includes/wc-deprecated-functions.php @@ -13,8 +13,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly function woocommerce_show_messages() { - _deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_messages' ); - wc_show_messages(); + _deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' ); + wc_print_notices(); } function woocommerce_weekend_area_js() { _deprecated_function( 'woocommerce_weekend_area_js', '2.1', '' ); diff --git a/includes/wc-notice-functions.php b/includes/wc-notice-functions.php index 43d1d1471513c..26982c439a4c5 100644 --- a/includes/wc-notice-functions.php +++ b/includes/wc-notice-functions.php @@ -61,10 +61,16 @@ function wc_clear_notices() { */ function wc_print_notices() { - foreach ( array( 'errors', 'messages', 'notices' ) as $notice_type ) { - if ( wc_notice_count( $notice_type ) > 0 ) { + $notice_types = array( + 'wc_errors' => 'errors', + 'wc_messages' => 'messages', + 'wc_notices' => 'notices' + ); + + foreach ( $notice_types as $notice_key => $notice_type ) { + if ( wc_notice_count( $notice_key ) > 0 ) { woocommerce_get_template( "shop/{$notice_type}.php", array( - $notice_type => WC()->session->get( "wc_{$notice_type}", array() ) + $notice_type => WC()->session->get( $notice_key, array() ) ) ); } } diff --git a/templates/cart/cart-empty.php b/templates/cart/cart-empty.php index b1c1c8fe00684..15cf47c6ce232 100644 --- a/templates/cart/cart-empty.php +++ b/templates/cart/cart-empty.php @@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly -wc_print_messages(); +wc_print_notices(); ?> diff --git a/templates/cart/cart.php b/templates/cart/cart.php index 7f4493d24c96f..2d76c1a5a6c4b 100755 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -11,7 +11,7 @@ global $woocommerce; -wc_print_messages(); +wc_print_notices(); do_action( 'woocommerce_before_cart' ); ?> diff --git a/templates/checkout/cart-errors.php b/templates/checkout/cart-errors.php index 960f96bc3c260..de573c3b1e17c 100644 --- a/templates/checkout/cart-errors.php +++ b/templates/checkout/cart-errors.php @@ -11,7 +11,7 @@ ?> - +

diff --git a/templates/checkout/form-checkout.php b/templates/checkout/form-checkout.php index 1da8d74492333..067187d833afb 100644 --- a/templates/checkout/form-checkout.php +++ b/templates/checkout/form-checkout.php @@ -11,7 +11,7 @@ global $woocommerce; -wc_print_messages(); +wc_print_notices(); do_action( 'woocommerce_before_checkout_form', $checkout ); diff --git a/templates/content-single-product.php b/templates/content-single-product.php index 38428887af48e..1d550aabf38e9 100644 --- a/templates/content-single-product.php +++ b/templates/content-single-product.php @@ -16,7 +16,7 @@ /** * woocommerce_before_single_product hook * - * @hooked wc_print_messages - 10 + * @hooked wc_print_notices - 10 */ do_action( 'woocommerce_before_single_product' ); diff --git a/templates/myaccount/form-change-password.php b/templates/myaccount/form-change-password.php index ca80a3d7e5800..116eee62eef61 100644 --- a/templates/myaccount/form-change-password.php +++ b/templates/myaccount/form-change-password.php @@ -12,7 +12,7 @@ global $woocommerce; ?> - +
diff --git a/templates/myaccount/form-edit-account.php b/templates/myaccount/form-edit-account.php index 82030cd114cca..7a85e6416b362 100644 --- a/templates/myaccount/form-edit-account.php +++ b/templates/myaccount/form-edit-account.php @@ -12,7 +12,7 @@ global $woocommerce; ?> - + diff --git a/templates/myaccount/form-edit-address.php b/templates/myaccount/form-edit-address.php index d15cea78d857f..f3c41de13655b 100644 --- a/templates/myaccount/form-edit-address.php +++ b/templates/myaccount/form-edit-address.php @@ -16,7 +16,7 @@ get_currentuserinfo(); ?> - + diff --git a/templates/myaccount/form-login.php b/templates/myaccount/form-login.php index 04db2334f7ac4..2cc4bd395693a 100644 --- a/templates/myaccount/form-login.php +++ b/templates/myaccount/form-login.php @@ -11,7 +11,7 @@ global $woocommerce; ?> - + diff --git a/templates/myaccount/form-lost-password.php b/templates/myaccount/form-lost-password.php index 236e510a448bb..c64ab854901ed 100644 --- a/templates/myaccount/form-lost-password.php +++ b/templates/myaccount/form-lost-password.php @@ -13,7 +13,7 @@ ?> - + diff --git a/templates/myaccount/my-account.php b/templates/myaccount/my-account.php index 05b0584c7006e..5639980466155 100644 --- a/templates/myaccount/my-account.php +++ b/templates/myaccount/my-account.php @@ -11,7 +11,7 @@ global $woocommerce; -wc_print_messages(); ?> +wc_print_notices(); ?>

show_messages', '2.1', 'wc_print_messages()' ); - wc_print_messages(); + _deprecated_function( 'Woocommerce->show_messages', '2.1', 'wc_print_notices()' ); + wc_print_notices(); } /**