WC_Abstract_Order::get_formatted_line_subtotal
Gets line subtotal - formatted for display.
Method of the class: WC_Abstract_Order{}
Hooks from the method
Returns
String.
Usage
$WC_Abstract_Order = new WC_Abstract_Order(); $WC_Abstract_Order->get_formatted_line_subtotal( $item, $tax_display );
- $item(object) (required)
- Item to get total from.
- $tax_display(string)
- Incl or excl tax display mode.
Default:''
WC_Abstract_Order::get_formatted_line_subtotal() WC Abstract Order::get formatted line subtotal code WC 10.7.0
public function get_formatted_line_subtotal( $item, $tax_display = '' ) {
$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );
if ( 'excl' === $tax_display ) {
$ex_tax_label = $this->get_prices_include_tax() ? 1 : 0;
$subtotal = wc_price(
$this->get_line_subtotal( $item ),
array(
'ex_tax_label' => $ex_tax_label,
'currency' => $this->get_currency(),
)
);
} else {
$subtotal = wc_price( $this->get_line_subtotal( $item, true ), array( 'currency' => $this->get_currency() ) );
}
return apply_filters( 'woocommerce_order_formatted_line_subtotal', $subtotal, $item, $this );
}