Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
WooCommercePayments::has_other_ecommerce_gateways
Check if the store has any enabled ecommerce gateways, other than WooPayments.
We exclude offline payment methods from this check.
Method of the class: WooCommercePayments{}
No Hooks.
Returns
true|false.
Usage
$result = WooCommercePayments::has_other_ecommerce_gateways(): bool;
WooCommercePayments::has_other_ecommerce_gateways() WooCommercePayments::has other ecommerce gateways code WC 10.6.2
public static function has_other_ecommerce_gateways(): bool {
$gateways = WC()->payment_gateways()->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 );
}