|
@@ 1588-1598 (lines=11) @@
|
| 1585 |
|
* @param bool $round (default: true). |
| 1586 |
|
* @return float |
| 1587 |
|
*/ |
| 1588 |
|
public function get_line_subtotal( $item, $inc_tax = false, $round = true ) { |
| 1589 |
|
if ( $inc_tax ) { |
| 1590 |
|
$price = $item['line_subtotal'] + $item['line_subtotal_tax']; |
| 1591 |
|
} else { |
| 1592 |
|
$price = $item['line_subtotal']; |
| 1593 |
|
} |
| 1594 |
|
|
| 1595 |
|
$price = $round ? round( $price, wc_get_price_decimals() ) : $price; |
| 1596 |
|
|
| 1597 |
|
return apply_filters( 'woocommerce_order_amount_line_subtotal', $price, $this, $item, $inc_tax, $round ); |
| 1598 |
|
} |
| 1599 |
|
|
| 1600 |
|
/** |
| 1601 |
|
* Calculate item cost - useful for gateways. |
|
@@ 1631-1640 (lines=10) @@
|
| 1628 |
|
* @param bool $round (default: true). |
| 1629 |
|
* @return float |
| 1630 |
|
*/ |
| 1631 |
|
public function get_line_total( $item, $inc_tax = false, $round = true ) { |
| 1632 |
|
|
| 1633 |
|
// Check if we need to add line tax to the line total. |
| 1634 |
|
$line_total = $inc_tax ? $item['line_total'] + $item['line_tax'] : $item['line_total']; |
| 1635 |
|
|
| 1636 |
|
// Check if we need to round. |
| 1637 |
|
$line_total = $round ? round( $line_total, wc_get_price_decimals() ) : $line_total; |
| 1638 |
|
|
| 1639 |
|
return apply_filters( 'woocommerce_order_amount_line_total', $line_total, $this, $item, $inc_tax, $round ); |
| 1640 |
|
} |
| 1641 |
|
|
| 1642 |
|
/** |
| 1643 |
|
* Calculate item tax - useful for gateways. |