|
@@ 280-288 (lines=9) @@
|
| 277 |
|
* @param boolean $inc_tax Should tax also be included in the subtotal? |
| 278 |
|
* @return float |
| 279 |
|
*/ |
| 280 |
|
public function get_items_subtotal( $inc_tax = true ) { |
| 281 |
|
$totals = array_values( wp_list_pluck( $this->items, 'subtotal' ) ); |
| 282 |
|
|
| 283 |
|
if ( $inc_tax ) { |
| 284 |
|
$totals = array_merge( $totals, array_values( wp_list_pluck( $this->items, 'subtotal_tax' ) ) ); |
| 285 |
|
} |
| 286 |
|
|
| 287 |
|
return array_sum( $totals ); |
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
/** |
| 291 |
|
* Get the total for all items. |
|
@@ 296-304 (lines=9) @@
|
| 293 |
|
* @param boolean $inc_tax Should tax also be included in the subtotal? |
| 294 |
|
* @return float |
| 295 |
|
*/ |
| 296 |
|
public function get_items_total( $inc_tax = true ) { |
| 297 |
|
$totals = array_values( wp_list_pluck( $this->items, 'total' ) ); |
| 298 |
|
|
| 299 |
|
if ( $inc_tax ) { |
| 300 |
|
$totals = array_merge( $totals, array_values( wp_list_pluck( $this->items, 'tax' ) ) ); |
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
return array_sum( $totals ); |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
/** |
| 307 |
|
* Get the total discount amount. |
|
@@ 436-444 (lines=9) @@
|
| 433 |
|
* @param boolean $inc_tax Should tax also be included in the subtotal? |
| 434 |
|
* @return float |
| 435 |
|
*/ |
| 436 |
|
public function get_fees_total( $inc_tax = true ) { |
| 437 |
|
$totals = array_values( wp_list_pluck( $this->fees, 'amount' ) ); |
| 438 |
|
|
| 439 |
|
if ( $inc_tax ) { |
| 440 |
|
$totals = array_merge( $totals, array_values( wp_list_pluck( $this->fees, 'tax' ) ) ); |
| 441 |
|
} |
| 442 |
|
|
| 443 |
|
return array_sum( $totals ); |
| 444 |
|
} |
| 445 |
|
|
| 446 |
|
/** |
| 447 |
|
* Get all tax rows for a set of items and shipping methods. |
|
@@ 514-522 (lines=9) @@
|
| 511 |
|
* @param boolean $inc_tax Should tax also be included in the subtotal? |
| 512 |
|
* @return float |
| 513 |
|
*/ |
| 514 |
|
public function get_shipping_total( $inc_tax = true ) { |
| 515 |
|
$totals = array_values( wp_list_pluck( $this->shipping_lines, 'total' ) ); |
| 516 |
|
|
| 517 |
|
if ( $inc_tax ) { |
| 518 |
|
$totals = array_merge( $totals, array_values( wp_list_pluck( $this->shipping_lines, 'total_tax' ) ) ); |
| 519 |
|
} |
| 520 |
|
|
| 521 |
|
return array_sum( $totals ); |
| 522 |
|
} |
| 523 |
|
|
| 524 |
|
/** |
| 525 |
|
* Set shipping lines. |