WC_Cart_Totals::get_item_tax_rates()protectedWC 1.0

Get tax rates for an item. Caches rates in class to avoid multiple look ups.

Метод класса: WC_Cart_Totals{}

Хуки из метода

Возвращает

Массив. of taxes

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_item_tax_rates( $item );
$item(объект) (обязательный)
Item to get tax rates for.

Код WC_Cart_Totals::get_item_tax_rates() WC 8.7.0

protected function get_item_tax_rates( $item ) {
	if ( ! wc_tax_enabled() ) {
		return array();
	}
	$tax_class      = $item->product->get_tax_class();
	$item_tax_rates = isset( $this->item_tax_rates[ $tax_class ] ) ? $this->item_tax_rates[ $tax_class ] : $this->item_tax_rates[ $tax_class ] = WC_Tax::get_rates( $item->product->get_tax_class(), $this->cart->get_customer() );

	// Allow plugins to filter item tax rates.
	return apply_filters( 'woocommerce_cart_totals_get_item_tax_rates', $item_tax_rates, $item, $this->cart );
}