WC_Abstract_Order::get_values_for_total()protectedWC 1.0

Return array of values for calculations.

Method of the class: WC_Abstract_Order{}

No Hooks.

Return

Array. Array of values.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_values_for_total( $field );
$field(string) (required)
Field name to return.

WC_Abstract_Order::get_values_for_total() code WC 8.7.0

protected function get_values_for_total( $field ) {
	$items = array_map(
		function ( $item ) use ( $field ) {
			return wc_add_number_precision( $item[ $field ], false );
		},
		array_values( $this->get_items() )
	);
	return $items;
}