WC_Order::get_total_tax_refunded_by_rate_id()publicWC 1.0

Get total tax refunded by rate ID.

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

Хуков нет.

Возвращает

float.

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

$WC_Order = new WC_Order();
$WC_Order->get_total_tax_refunded_by_rate_id( $rate_id );
$rate_id(int) (обязательный)
Rate ID.

Код WC_Order::get_total_tax_refunded_by_rate_id() WC 9.4.2

public function get_total_tax_refunded_by_rate_id( $rate_id ) {
	$total = 0;
	foreach ( $this->get_refunds() as $refund ) {
		foreach ( $refund->get_items( 'tax' ) as $refunded_item ) {
			if ( absint( $refunded_item->get_rate_id() ) === $rate_id ) {
				$total += abs( $refunded_item->get_tax_total() ) + abs( $refunded_item->get_shipping_tax_total() );
			}
		}
	}

	return $total;
}