Merge pull request #4241 from ragulka/master

Fix: customer should be able to pay for a new order
This commit is contained in:
Mike Jolley 2013-11-28 07:30:03 -08:00
commit 4a5c965728
1 changed files with 10 additions and 1 deletions

View File

@ -282,7 +282,16 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
case 'pay_for_order':
$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 )
$allcaps['pay_for_order'] = true;