Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
WooPayments::has_enabled_other_ecommerce_gateways
Check if the store has any other enabled ecommerce gateways.
We exclude offline payment methods from this check.
Method of the class: WooPayments{}
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_other_ecommerce_gateways(): bool;
WooPayments::has_enabled_other_ecommerce_gateways() WooPayments::has enabled other ecommerce gateways code WC 10.9.4
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', ...PaymentsProviders::OFFLINE_METHODS ),
true
);
}
);
return ! empty( $other_ecommerce_gateways );
}