WC_Abstract_Order::get_line_subtotal( object $item, bool $inc_tax = false, bool $round = true )
Get line subtotal – this is the cost before discount.
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_subtotal( $item, $inc_tax = false, $round = true ) { $subtotal = 0; if ( is_callable( array( $item, 'get_subtotal' ) ) ) { if ( $inc_tax ) { $subtotal = $item->get_subtotal() + $item->get_subtotal_tax(); } else { $subtotal = $item->get_subtotal(); } $subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal; } return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round ); }