WordPress at Your Fingertips
function is not described

WC_Discounts::get_discount() public WC 3.2.0

Get discount by key with or without precision.

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

No Hooks.

Return

float.

Usage

$WC_Discounts = new WC_Discounts();
$WC_Discounts->get_discount( $key, $in_cents );
$key(string) (required)
name of discount row to return.
$in_cents(true|false)
Should the totals be returned in cents, or without precision.
Default: false

Changelog

Since 3.2.0 Introduced.

Code of WC_Discounts::get_discount() WC 5.6.0

public function get_discount( $key, $in_cents = false ) {
	$item_discount_totals = $this->get_discounts_by_item( $in_cents );
	return isset( $item_discount_totals[ $key ] ) ? $item_discount_totals[ $key ] : 0;
}