WordPress at Your Fingertips
function is not described

WC_Cart_Totals::combine_item_taxes() protected WC 3.2.0

Combine item taxes into a single array, preserving keys.

{} It's a method of the class: WC_Cart_Totals{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->combine_item_taxes( $item_taxes );
$item_taxes(array) (required)
Taxes to combine.

Changelog

Since 3.2.0 Introduced.

Code of WC_Cart_Totals::combine_item_taxes() WC 5.9.0

protected function combine_item_taxes( $item_taxes ) {
	$merged_taxes = array();
	foreach ( $item_taxes as $taxes ) {
		foreach ( $taxes as $tax_id => $tax_amount ) {
			if ( ! isset( $merged_taxes[ $tax_id ] ) ) {
				$merged_taxes[ $tax_id ] = 0;
			}
			$merged_taxes[ $tax_id ] += $tax_amount;
		}
	}
	return $merged_taxes;
}