WC_Abstract_Order::get_formatted_line_subtotal( object $item, string $tax_display = '' )

Gets line subtotal – formatted for display.


Description Description


Parameters Parameters

$item

(Required) Item to get total from.

$tax_display

(Optional) Incl or excl tax display mode.

Default value: ''


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/abstracts/abstract-wc-order.php

1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
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 );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.