WordPress at Your Fingertips
function is not described

WC_Cart::get_coupon_discount_amount() public WC 1.0

Get the discount amount for a used coupon.

{} It's a method of the class: WC_Cart{}

No Hooks.

Return

float. discount amount

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->get_coupon_discount_amount( $code, $ex_tax );
$code(string) (required)
coupon code.
$ex_tax(true|false)
inc or ex tax.
Default: true

Code of WC_Cart::get_coupon_discount_amount() WC 5.7.1

public function get_coupon_discount_amount( $code, $ex_tax = true ) {
	$totals          = $this->get_coupon_discount_totals();
	$discount_amount = isset( $totals[ $code ] ) ? $totals[ $code ] : 0;

	if ( ! $ex_tax ) {
		$discount_amount += $this->get_coupon_discount_tax_amount( $code );
	}

	return wc_cart_round_discount( $discount_amount, wc_get_price_decimals() );
}