Merge pull request #24435 from strayobject/fix-show-error-in-myaccount-when-order-missing
fix: show error message in myaccount if order does not exist.
This commit is contained in:
commit
9c9715ac8d
|
@ -133,7 +133,7 @@ class WC_Shortcode_My_Account {
|
|||
public static function view_order( $order_id ) {
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
if ( ! 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>';
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue