Merge pull request #4241 from ragulka/master
Fix: customer should be able to pay for a new order
This commit is contained in:
commit
4a5c965728
|
@ -282,7 +282,16 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
|
||||||
|
|
||||||
case 'pay_for_order':
|
case 'pay_for_order':
|
||||||
$user_id = $args[1];
|
$user_id = $args[1];
|
||||||
$order = new WC_Order( $args[2] );
|
$order_id = isset($args[2]) ? $args[2] : null;
|
||||||
|
|
||||||
|
// When no order ID, we assume it's a new order
|
||||||
|
// and thus, customer can pay for it
|
||||||
|
if (!$order_id) {
|
||||||
|
$allcaps['pay_for_order'] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = new WC_Order( $order_id );
|
||||||
|
|
||||||
if ( $user_id == $order->user_id )
|
if ( $user_id == $order->user_id )
|
||||||
$allcaps['pay_for_order'] = true;
|
$allcaps['pay_for_order'] = true;
|
||||||
|
|
Loading…
Reference in New Issue