diff --git a/plugins/woocommerce/includes/class-wc-ajax.php b/plugins/woocommerce/includes/class-wc-ajax.php
index b0e39aae036..ee55e6c8287 100644
--- a/plugins/woocommerce/includes/class-wc-ajax.php
+++ b/plugins/woocommerce/includes/class-wc-ajax.php
@@ -298,7 +298,12 @@ class WC_AJAX {
'fragments' => apply_filters(
'woocommerce_update_order_review_fragments',
array(
- 'form.woocommerce-checkout' => '
',
+ 'form.woocommerce-checkout' => wc_print_notice(
+ esc_html__( 'Sorry, your session has expired.', 'woocommerce' ) . ' ' . __( 'Return to shop', 'woocommerce' ) . '',
+ 'error',
+ [],
+ true
+ ),
)
),
)
diff --git a/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php b/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php
index b61d1697ed0..3a569201d82 100644
--- a/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php
+++ b/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-my-account.php
@@ -134,8 +134,10 @@ class WC_Shortcode_My_Account {
$order = wc_get_order( $order_id );
if ( ! $order || ! current_user_can( 'view_order', $order_id ) ) {
- echo '';
-
+ wc_print_notice(
+ esc_html__( 'Invalid order.', 'woocommerce' ) . ' ' . esc_html__( 'My account', 'woocommerce' ) . '',
+ 'error'
+ );
return;
}