Automattic\WooCommerce\Internal\Admin\Settings

PaymentProviders::has_enabled_ecommerce_gatewaysprivateWC 1.0

Check if the store has any enabled ecommerce gateways.

We exclude offline payment methods from this check.

Method of the class: PaymentProviders{}

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_ecommerce_gateways(): bool;

PaymentProviders::has_enabled_ecommerce_gateways() code WC 9.9.4

private function has_enabled_ecommerce_gateways(): bool {
	$gateways         = $this->get_payment_gateways();
	$enabled_gateways = array_filter(
		$gateways,
		function ( $gateway ) {
			// Filter out offline gateways.
			return 'yes' === $gateway->enabled && ! $this->is_offline_payment_method( $gateway->id );
		}
	);

	return ! empty( $enabled_gateways );
}