WC_Abstract_Order::get_line_total()publicWC 1.0

Calculate line total - useful for gateways.

Method of the class: WC_Abstract_Order{}

Hooks from the method

Return

float.

Usage

$WC_Abstract_Order = new WC_Abstract_Order();
$WC_Abstract_Order->get_line_total( $item, $inc_tax, $round );
$item(object) (required)
Item to get total from.
$inc_tax(true|false)
-
Default: false)
$round(true|false)
-
Default: true)

WC_Abstract_Order::get_line_total() code WC 8.7.0

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 ? (float) $item->get_total() + (float) $item->get_total_tax() : (float) $item->get_total();

		// Check if we need to round.
		$total = $round ? NumberUtil::round( $total, wc_get_price_decimals() ) : $total;
	}

	return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
}