WC_Payment_Gateway::is_availablepublicWC 10.7.0

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() code WC 10.8.1

public function is_available() {
	if ( 'yes' !== $this->enabled ) {
		return false;
	}

	$is_available = true;

	if ( WC()->cart && 0 < $this->get_order_total() && 0 < $this->max_amount && $this->max_amount < $this->get_order_total() ) {
		$is_available = false;
	}

	return $is_available;
}