WC_Payment_Gateway::is_available
Check if the gateway is available for use.
Method of the class: WC_Payment_Gateway{}
No Hooks.
Returns
true|false.
Usage
$WC_Payment_Gateway = new WC_Payment_Gateway(); $WC_Payment_Gateway->is_available();
Changelog
| Since 10.7.0 | Introduced. |
| Since 10.7.0 | Added early return when gateway is disabled. |
WC_Payment_Gateway::is_available() WC Payment Gateway::is available code WC 10.9.3
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;
}