WC_Gateway_Paypal_Request::get_paypal_order_items_subtotalprivateWC 1.0

Get the subtotal for all items, before discounts.

Method of the class: WC_Gateway_Paypal_Request{}

No Hooks.

Returns

float.

Usage

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

WC_Gateway_Paypal_Request::get_paypal_order_items_subtotal() code WC 10.4.3

private function get_paypal_order_items_subtotal( $order ) {
	$total = 0;
	foreach ( $order->get_items( array( 'line_item', 'fee' ) ) as $item ) {
		$total += wc_add_number_precision( $this->get_paypal_order_item_amount( $order, $item ) * $item->get_quantity(), false );
	}

	return wc_remove_number_precision( $total );
}