Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

WCCore::is_account_connectedpublicWC 1.0

Check if the payment gateway has a payments processor account connected.

Method of the class: WCCore{}

No Hooks.

Returns

true|false. True if the payment gateway account is connected, false otherwise. If the payment gateway does not provide the information, it will return true.

Usage

$WCCore = new WCCore();
$WCCore->is_account_connected( $payment_gateway ): bool;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.

WCCore::is_account_connected() code WC 10.8.1

public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
	// Provide custom account connected logic for core payment gateways.
	switch ( $payment_gateway->id ) {
		case WC_Gateway_BACS::ID:
			// BACS requires bank account details to be set up.
			return property_exists( $payment_gateway, 'account_details' ) && ! empty( $payment_gateway->account_details );
		case WC_Gateway_Cheque::ID:
		case WC_Gateway_COD::ID:
			// There is no account setup for these gateways, so we return true.
			return true;
		case WC_Gateway_Paypal::ID:
			// PayPal requires just an account email address to be set up.
			return property_exists( $payment_gateway, 'email' ) && is_email( $payment_gateway->email );
	}

	return parent::is_account_connected( $payment_gateway );
}