WC_Discounts::get_discount( string $key, bool $in_cents = false )

Get discount by key with or without precision.


Description Description


Parameters Parameters

$key

(Required) name of discount row to return.

$in_cents

(Optional) Should the totals be returned in cents, or without precision.

Default value: false


Top ↑

Return Return

(float)


Top ↑

Source Source

File: includes/class-wc-discounts.php

	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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.