| @@ 446-454 (lines=9) @@ | ||
| 443 | } |
|
| 444 | ||
| 445 | // customer ID |
|
| 446 | if ( isset( $data['customer_id'] ) && $data['customer_id'] != $order->get_user_id() ) { |
|
| 447 | ||
| 448 | // make sure customer exists |
|
| 449 | if ( false === get_user_by( 'id', $data['customer_id'] ) ) { |
|
| 450 | throw new WC_CLI_Exception( 'woocommerce_cli_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ) ); |
|
| 451 | } |
|
| 452 | ||
| 453 | update_post_meta( $order->id, '_customer_user', $data['customer_id'] ); |
|
| 454 | } |
|
| 455 | ||
| 456 | // billing/shipping address |
|
| 457 | $this->set_order_addresses( $order, $data ); |
|
| @@ 586-594 (lines=9) @@ | ||
| 583 | } |
|
| 584 | ||
| 585 | // Customer ID. |
|
| 586 | if ( isset( $data['customer_id'] ) && $data['customer_id'] != $order->get_user_id() ) { |
|
| 587 | // Make sure customer exists. |
|
| 588 | if ( false === get_user_by( 'id', $data['customer_id'] ) ) { |
|
| 589 | throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ), 400 ); |
|
| 590 | } |
|
| 591 | ||
| 592 | update_post_meta( $order->id, '_customer_user', $data['customer_id'] ); |
|
| 593 | } |
|
| 594 | ||
| 595 | // Billing/shipping address. |
|
| 596 | $this->set_order_addresses( $order, $data ); |
|
| 597 | ||