WC_Abstract_Order::get_line_total( object $item, bool $inc_tax = false, bool $round = true )
Calculate line total – useful for gateways.
Description Description
Parameters Parameters
- $item
-
(Required) Item to get total from.
- $inc_tax
-
(Optional) (default: false).
Default value: false
- $round
-
(Optional) (default: true).
Default value: true
Return Return
(float)
Source Source
File: includes/abstracts/abstract-wc-order.php
public function get_line_total( $item, $inc_tax = false, $round = true ) { $total = 0; if ( is_callable( array( $item, 'get_total' ) ) ) { // Check if we need to add line tax to the line total. $total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total(); // Check if we need to round. $total = $round ? round( $total, wc_get_price_decimals() ) : $total; } return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round ); }