|
@@ 1609-1619 (lines=11) @@
|
| 1606 |
|
* @param bool $round (default: true). |
| 1607 |
|
* @return float |
| 1608 |
|
*/ |
| 1609 |
|
public function get_line_subtotal( $item, $inc_tax = false, $round = true ) { |
| 1610 |
|
if ( $inc_tax ) { |
| 1611 |
|
$price = $item['line_subtotal'] + $item['line_subtotal_tax']; |
| 1612 |
|
} else { |
| 1613 |
|
$price = $item['line_subtotal']; |
| 1614 |
|
} |
| 1615 |
|
|
| 1616 |
|
$price = $round ? round( $price, wc_get_price_decimals() ) : $price; |
| 1617 |
|
|
| 1618 |
|
return apply_filters( 'woocommerce_order_amount_line_subtotal', $price, $this, $item, $inc_tax, $round ); |
| 1619 |
|
} |
| 1620 |
|
|
| 1621 |
|
/** |
| 1622 |
|
* Calculate item cost - useful for gateways. |
|
@@ 1652-1661 (lines=10) @@
|
| 1649 |
|
* @param bool $round (default: true). |
| 1650 |
|
* @return float |
| 1651 |
|
*/ |
| 1652 |
|
public function get_line_total( $item, $inc_tax = false, $round = true ) { |
| 1653 |
|
|
| 1654 |
|
// Check if we need to add line tax to the line total. |
| 1655 |
|
$line_total = $inc_tax ? $item['line_total'] + $item['line_tax'] : $item['line_total']; |
| 1656 |
|
|
| 1657 |
|
// Check if we need to round. |
| 1658 |
|
$line_total = $round ? round( $line_total, wc_get_price_decimals() ) : $line_total; |
| 1659 |
|
|
| 1660 |
|
return apply_filters( 'woocommerce_order_amount_line_total', $line_total, $this, $item, $inc_tax, $round ); |
| 1661 |
|
} |
| 1662 |
|
|
| 1663 |
|
/** |
| 1664 |
|
* Calculate item tax - useful for gateways. |