Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

WooCommercePayments::has_other_ecommerce_gateways()public staticWC 1.0

Check if the store has any enabled ecommerce gateways, other than WooPayments.

We exclude offline payment methods from this check.

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

Хуков нет.

Возвращает

true|false.

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

$result = WooCommercePayments::has_other_ecommerce_gateways(): bool;

Код WooCommercePayments::has_other_ecommerce_gateways() WC 9.7.1

public static function has_other_ecommerce_gateways(): bool {
	$gateways         = WC()->payment_gateways->get_available_payment_gateways();
	$enabled_gateways = array_filter(
		$gateways,
		function ( $gateway ) {
			// Filter out any WooPayments-related or offline gateways.
			return 'yes' === $gateway->enabled
				&& 0 !== strpos( $gateway->id, 'woocommerce_payments' )
				&& ! in_array( $gateway->id, array( WC_Gateway_BACS::ID, WC_Gateway_Cheque::ID, WC_Gateway_COD::ID ), true );
		}
	);

	return ! empty( $enabled_gateways );
}