WC_Cart_Totals::combine_item_taxes()
Combine item taxes into a single array, preserving keys.
Метод класса: WC_Cart_Totals{}
Хуков нет.
Возвращает
Массив
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->combine_item_taxes( $item_taxes );
- $item_taxes(массив) (обязательный)
- Taxes to combine.
Список изменений
С версии 3.2.0 | Введена. |
Код WC_Cart_Totals::combine_item_taxes() WC Cart Totals::combine item taxes WC 8.7.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; }