| @@ 121-123 (lines=3) @@ | ||
| 118 | // create the pending order |
|
| 119 | $order = $this->create_base_order( $default_order_args, $data ); |
|
| 120 | ||
| 121 | if ( is_wp_error( $order ) ) { |
|
| 122 | throw new WC_CLI_Exception( 'woocommerce_cli_cannot_create_order', sprintf( __( 'Cannot create order: %s', 'woocommerce' ), implode( ', ', $order->get_error_messages() ) ) ); |
|
| 123 | } |
|
| 124 | ||
| 125 | // billing/shipping addresses |
|
| 126 | $this->set_order_addresses( $order, $data ); |
|
| @@ 444-446 (lines=3) @@ | ||
| 441 | 'created_via' => 'rest-api', |
|
| 442 | ), $request ); |
|
| 443 | ||
| 444 | if ( is_wp_error( $order ) ) { |
|
| 445 | throw new WC_REST_Exception( 'woocommerce_rest_cannot_create_order', sprintf( __( 'Cannot create order: %s.', 'woocommerce' ), implode( ', ', $order->get_error_messages() ) ), 400 ); |
|
| 446 | } |
|
| 447 | ||
| 448 | // Set addresses. |
|
| 449 | if ( is_array( $request['billing'] ) ) { |
|