WC_Cart_Totals::get_merged_taxes()
Get taxes merged by type.
Метод класса: WC_Cart_Totals{}
Хуков нет.
Возвращает
Массив
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_merged_taxes( $in_cents, $types, fooo, foooo ) );
- $in_cents(true|false)
- If returned value should be in cents.
По умолчанию: false - $types(массив|строка)
- Types to merge and return.
По умолчанию: all - fooo (обязательный)
- -
- foooo ) (обязательный)
- -
Список изменений
С версии 3.2.0 | Введена. |
Код WC_Cart_Totals::get_merged_taxes() WC Cart Totals::get merged taxes WC 8.7.0
protected function get_merged_taxes( $in_cents = false, $types = array( 'items', 'fees', 'shipping' ) ) { $items = array(); $taxes = array(); if ( is_string( $types ) ) { $types = array( $types ); } foreach ( $types as $type ) { if ( isset( $this->$type ) ) { $items = array_merge( $items, $this->$type ); } } foreach ( $items as $item ) { foreach ( $item->taxes as $rate_id => $rate ) { if ( ! isset( $taxes[ $rate_id ] ) ) { $taxes[ $rate_id ] = 0; } $taxes[ $rate_id ] += $this->round_line_tax( $rate ); } } return $in_cents ? $taxes : wc_remove_number_precision_deep( $taxes ); }