|
@@ 1511-1521 (lines=11) @@
|
| 1508 |
|
* @param bool $round (default: true). |
| 1509 |
|
* @return float |
| 1510 |
|
*/ |
| 1511 |
|
public function get_line_subtotal( $item, $inc_tax = false, $round = true ) { |
| 1512 |
|
if ( $inc_tax ) { |
| 1513 |
|
$price = $item['line_subtotal'] + $item['line_subtotal_tax']; |
| 1514 |
|
} else { |
| 1515 |
|
$price = $item['line_subtotal']; |
| 1516 |
|
} |
| 1517 |
|
|
| 1518 |
|
$price = $round ? round( $price, wc_get_price_decimals() ) : $price; |
| 1519 |
|
|
| 1520 |
|
return apply_filters( 'woocommerce_order_amount_line_subtotal', $price, $this, $item, $inc_tax, $round ); |
| 1521 |
|
} |
| 1522 |
|
|
| 1523 |
|
/** |
| 1524 |
|
* Calculate item cost - useful for gateways. |
|
@@ 1554-1563 (lines=10) @@
|
| 1551 |
|
* @param bool $round (default: true). |
| 1552 |
|
* @return float |
| 1553 |
|
*/ |
| 1554 |
|
public function get_line_total( $item, $inc_tax = false, $round = true ) { |
| 1555 |
|
|
| 1556 |
|
// Check if we need to add line tax to the line total. |
| 1557 |
|
$line_total = $inc_tax ? $item['line_total'] + $item['line_tax'] : $item['line_total']; |
| 1558 |
|
|
| 1559 |
|
// Check if we need to round. |
| 1560 |
|
$line_total = $round ? round( $line_total, wc_get_price_decimals() ) : $line_total; |
| 1561 |
|
|
| 1562 |
|
return apply_filters( 'woocommerce_order_amount_line_total', $line_total, $this, $item, $inc_tax, $round ); |
| 1563 |
|
} |
| 1564 |
|
|
| 1565 |
|
/** |
| 1566 |
|
* Calculate item tax - useful for gateways. |