WC_Payment_Gateway::is_available
Check if the gateway is available for use.
Метод класса: WC_Payment_Gateway{}
Хуков нет.
Возвращает
true|false.
Использование
$WC_Payment_Gateway = new WC_Payment_Gateway(); $WC_Payment_Gateway->is_available();
Список изменений
| С версии 10.7.0 | Введена. |
| С версии 10.7.0 | Added early return when gateway is disabled. |
Код WC_Payment_Gateway::is_available() WC Payment Gateway::is available WC 10.9.4
public function is_available() {
$is_available = 'yes' === $this->enabled;
if ( $is_available && WC()->cart ) {
$order_total = $this->get_order_total();
if ( 0 < $order_total && 0 < $this->max_amount && $order_total > $this->max_amount ) {
$is_available = false;
}
}
return $is_available;
}