WC_Abstract_Order::get_line_total()
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() WC Abstract Order::get line total code WC 9.7.1
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 ); }