includes/cli/class-wc-cli-order.php 1 location
|
@@ 135-142 (lines=8) @@
|
| 132 |
|
'coupon' => 'coupon_lines', |
| 133 |
|
); |
| 134 |
|
|
| 135 |
|
foreach ( $lines as $line_type => $line ) { |
| 136 |
|
if ( isset( $data[ $line ] ) && is_array( $data[ $line ] ) ) { |
| 137 |
|
$set_item = "set_{$line_type}"; |
| 138 |
|
foreach ( $data[ $line ] as $item ) { |
| 139 |
|
$this->$set_item( $order, $item, 'create' ); |
| 140 |
|
} |
| 141 |
|
} |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
// calculate totals and set them |
| 145 |
|
$order->calculate_totals(); |
includes/api/class-wc-rest-orders-controller.php 1 location
|
@@ 457-464 (lines=8) @@
|
| 454 |
|
'coupon' => 'coupon_lines', |
| 455 |
|
); |
| 456 |
|
|
| 457 |
|
foreach ( $lines as $line_type => $line ) { |
| 458 |
|
if ( is_array( $request[ $line ] ) ) { |
| 459 |
|
foreach ( $request[ $line ] as $item ) { |
| 460 |
|
$set_item = 'set_' . $line_type; |
| 461 |
|
$new_item = $this->$set_item( $order, $item, 'create' ); |
| 462 |
|
} |
| 463 |
|
} |
| 464 |
|
} |
| 465 |
|
|
| 466 |
|
// Calculate totals and set them. |
| 467 |
|
$order->calculate_totals(); |
includes/api/legacy/v2/class-wc-api-orders.php 1 location
|
@@ 430-441 (lines=12) @@
|
| 427 |
|
'coupon' => 'coupon_lines', |
| 428 |
|
); |
| 429 |
|
|
| 430 |
|
foreach ( $lines as $line_type => $line ) { |
| 431 |
|
|
| 432 |
|
if ( isset( $data[ $line ] ) && is_array( $data[ $line ] ) ) { |
| 433 |
|
|
| 434 |
|
$set_item = "set_{$line_type}"; |
| 435 |
|
|
| 436 |
|
foreach ( $data[ $line ] as $item ) { |
| 437 |
|
|
| 438 |
|
$this->$set_item( $order, $item, 'create' ); |
| 439 |
|
} |
| 440 |
|
} |
| 441 |
|
} |
| 442 |
|
|
| 443 |
|
// calculate totals and set them |
| 444 |
|
$order->calculate_totals(); |
includes/api/legacy/v3/class-wc-api-orders.php 1 location
|
@@ 462-473 (lines=12) @@
|
| 459 |
|
'coupon' => 'coupon_lines', |
| 460 |
|
); |
| 461 |
|
|
| 462 |
|
foreach ( $lines as $line_type => $line ) { |
| 463 |
|
|
| 464 |
|
if ( isset( $data[ $line ] ) && is_array( $data[ $line ] ) ) { |
| 465 |
|
|
| 466 |
|
$set_item = "set_{$line_type}"; |
| 467 |
|
|
| 468 |
|
foreach ( $data[ $line ] as $item ) { |
| 469 |
|
|
| 470 |
|
$this->$set_item( $order, $item, 'create' ); |
| 471 |
|
} |
| 472 |
|
} |
| 473 |
|
} |
| 474 |
|
|
| 475 |
|
// set is vat exempt |
| 476 |
|
if ( isset( $data['is_vat_exempt'] ) ) { |