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
Return Return
(float)
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; }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |