Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

WooPayments::has_enabled_other_ecommerce_gatewaysprivateWC 1.0

Check if the store has any other enabled ecommerce gateways.

We exclude offline payment methods from this check.

Method of the class: WooPayments{}

No Hooks.

Returns

true|false. True if the store has any enabled ecommerce gateways, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->has_enabled_other_ecommerce_gateways(): bool;

WooPayments::has_enabled_other_ecommerce_gateways() code WC 9.9.4

private function has_enabled_other_ecommerce_gateways(): bool {
	$gateways                 = WC()->payment_gateways()->payment_gateways;
	$other_ecommerce_gateways = array_filter(
		$gateways,
		function ( $gateway ) {
			// Filter out offline gateways and WooPayments.
			return 'yes' === $gateway->enabled &&
				! in_array(
					$gateway->id,
					array( 'woocommerce_payments', ...PaymentProviders::OFFLINE_METHODS ),
					true
				);
		}
	);

	return ! empty( $other_ecommerce_gateways );
}