Verify order was found
Verify the order was found before evaluating the user_id on the $order object. Would previously throw an error if attempting to view an invalid order number.
This commit is contained in:
parent
1e06f82f59
commit
0f88f6386b
|
@ -277,7 +277,7 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
|
|||
$user_id = $args[1];
|
||||
$order = wc_get_order( $args[2] );
|
||||
|
||||
if ( $user_id == $order->user_id ) {
|
||||
if ( $order && $user_id == $order->user_id ) {
|
||||
$allcaps['view_order'] = true;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue