WC_Cart::get_coupon_discount_tax_amount
Get the discount tax amount for a used coupon (for tax inclusive prices).
Метод класса: WC_Cart{}
Хуков нет.
Возвращает
float. discount amount
Использование
$WC_Cart = new WC_Cart(); $WC_Cart->get_coupon_discount_tax_amount( $code );
- $code(строка) (обязательный)
- coupon code.
Код WC_Cart::get_coupon_discount_tax_amount() WC Cart::get coupon discount tax amount WC 11.3.0
public function get_coupon_discount_tax_amount( $code ) {
$totals = $this->get_coupon_discount_tax_totals();
$tax_amount = 0;
foreach ( $totals as $key => $value ) {
if ( wc_is_same_coupon( $key, $code ) ) {
$tax_amount = $value;
break;
}
}
return wc_cart_round_discount( $tax_amount, wc_get_price_decimals() );
}