WC_Discounts::get_discount() public WC 3.2.0
Get discount by key with or without precision.
{} Это метод класса: WC_Discounts{}
Хуков нет.
Возвращает
float.
Использование
$WC_Discounts = new WC_Discounts(); $WC_Discounts->get_discount( $key, $in_cents );
- $key(строка) (обязательный)
- name of discount row to return.
- $in_cents(true/false)
- Should the totals be returned in cents, or without precision.
Список изменений
С версии 3.2.0 | Введена. |
Код WC_Discounts::get_discount() WC Discounts::get discount WC 5.0.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;
}