|
@@ 1315-1329 (lines=15) @@
|
| 1312 |
|
* @param bool $round (default: true). |
| 1313 |
|
* @return float |
| 1314 |
|
*/ |
| 1315 |
|
public function get_line_subtotal( $item, $inc_tax = false, $round = true ) { |
| 1316 |
|
$subtotal = 0; |
| 1317 |
|
|
| 1318 |
|
if ( is_callable( array( $item, 'get_subtotal' ) ) ) { |
| 1319 |
|
if ( $inc_tax ) { |
| 1320 |
|
$subtotal = $item->get_subtotal() + $item->get_subtotal_tax(); |
| 1321 |
|
} else { |
| 1322 |
|
$subtotal = $item->get_subtotal(); |
| 1323 |
|
} |
| 1324 |
|
|
| 1325 |
|
$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal; |
| 1326 |
|
} |
| 1327 |
|
|
| 1328 |
|
return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round ); |
| 1329 |
|
} |
| 1330 |
|
|
| 1331 |
|
/** |
| 1332 |
|
* Calculate item cost - useful for gateways. |
|
@@ 1363-1375 (lines=13) @@
|
| 1360 |
|
* @param bool $round (default: true). |
| 1361 |
|
* @return float |
| 1362 |
|
*/ |
| 1363 |
|
public function get_line_total( $item, $inc_tax = false, $round = true ) { |
| 1364 |
|
$total = 0; |
| 1365 |
|
|
| 1366 |
|
if ( is_callable( array( $item, 'get_total' ) ) ) { |
| 1367 |
|
// Check if we need to add line tax to the line total. |
| 1368 |
|
$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total(); |
| 1369 |
|
|
| 1370 |
|
// Check if we need to round. |
| 1371 |
|
$total = $round ? round( $total, wc_get_price_decimals() ) : $total; |
| 1372 |
|
} |
| 1373 |
|
|
| 1374 |
|
return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round ); |
| 1375 |
|
} |
| 1376 |
|
|
| 1377 |
|
/** |
| 1378 |
|
* Get item tax - useful for gateways. |