Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

WooPayments::has_enabled_other_ecommerce_gateways()privateWC 1.0

Check if the store has any other enabled ecommerce gateways.

We exclude offline payment methods from this check.

Метод класса: WooPayments{}

Хуков нет.

Возвращает

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

Использование

// private - только в коде основоного (родительского) класса
$result = $this->has_enabled_other_ecommerce_gateways(): bool;

Код WooPayments::has_enabled_other_ecommerce_gateways() WC 9.6.1

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 );
}