WC_Discounts::get_discount()
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.
По умолчанию: false
Список изменений
С версии 3.2.0 | Введена. |
Код WC_Discounts::get_discount() WC Discounts::get discount WC 8.7.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; }