Replace hardcoded error notices with wp_print_notice
This commit is contained in:
parent
ec6ed5c97c
commit
abfe701f8b
|
@ -298,7 +298,12 @@ class WC_AJAX {
|
||||||
'fragments' => apply_filters(
|
'fragments' => apply_filters(
|
||||||
'woocommerce_update_order_review_fragments',
|
'woocommerce_update_order_review_fragments',
|
||||||
array(
|
array(
|
||||||
'form.woocommerce-checkout' => '<div class="woocommerce-error">' . __( 'Sorry, your session has expired.', 'woocommerce' ) . ' <a href="' . esc_url( wc_get_page_permalink( 'shop' ) ) . '" class="wc-backward">' . __( 'Return to shop', 'woocommerce' ) . '</a></div>',
|
'form.woocommerce-checkout' => wc_print_notice(
|
||||||
|
esc_html__( 'Sorry, your session has expired.', 'woocommerce' ) . ' <a href="' . esc_url( wc_get_page_permalink( 'shop' ) ) . '" class="wc-backward">' . __( 'Return to shop', 'woocommerce' ) . '</a>',
|
||||||
|
'error',
|
||||||
|
[],
|
||||||
|
true
|
||||||
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -134,8 +134,10 @@ class WC_Shortcode_My_Account {
|
||||||
$order = wc_get_order( $order_id );
|
$order = wc_get_order( $order_id );
|
||||||
|
|
||||||
if ( ! $order || ! current_user_can( 'view_order', $order_id ) ) {
|
if ( ! $order || ! current_user_can( 'view_order', $order_id ) ) {
|
||||||
echo '<div class="woocommerce-error">' . esc_html__( 'Invalid order.', 'woocommerce' ) . ' <a href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '" class="wc-forward">' . esc_html__( 'My account', 'woocommerce' ) . '</a></div>';
|
wc_print_notice(
|
||||||
|
esc_html__( 'Invalid order.', 'woocommerce' ) . ' <a href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '" class="wc-forward">' . esc_html__( 'My account', 'woocommerce' ) . '</a>',
|
||||||
|
'error'
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue