WC_API_Orders::get_order_subtotal()privateWC 2.1

Helper method to get the order subtotal

Method of the class: WC_API_Orders{}

No Hooks.

Return

float.

Usage

// private - for code of main (parent) class only
$result = $this->get_order_subtotal( $order );
$order(WC_Order) (required)
-

Changelog

Since 2.1 Introduced.

WC_API_Orders::get_order_subtotal() code WC 8.9.0

private function get_order_subtotal( $order ) {
	$subtotal = 0;

	// subtotal
	foreach ( $order->get_items() as $item ) {
		$subtotal += $item->get_subtotal();
	}

	return $subtotal;
}