Automattic\WooCommerce\Internal\Admin\Settings

PaymentsController::store_has_enabled_gatewaysprivateWC 1.0

Check if the store has any enabled gateways (including offline payment methods).

Method of the class: PaymentsController{}

No Hooks.

Returns

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

Usage

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

PaymentsController::store_has_enabled_gateways() code WC 9.9.4

private function store_has_enabled_gateways(): bool {
	$gateways         = WC()->payment_gateways->get_available_payment_gateways();
	$enabled_gateways = array_filter(
		$gateways,
		function ( $gateway ) {
			return 'yes' === $gateway->enabled;
		}
	);

	return ! empty( $enabled_gateways );
}