Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
AdditionalPayments::has_enabled_gateways()
Check if the store has any enabled gateways based on the given criteria.
Метод класса: AdditionalPayments{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = AdditionalPayments::has_enabled_gateways( $filter );
- $filter(callable|null)
- A callback function to filter the gateways.
По умолчанию: null
Код AdditionalPayments::has_enabled_gateways() AdditionalPayments::has enabled gateways WC 9.7.1
private static function has_enabled_gateways( $filter = null ) { $gateways = WC()->payment_gateways->get_available_payment_gateways(); $enabled_gateways = array_filter( $gateways, function( $gateway ) use ( $filter ) { if ( is_callable( $filter ) ) { return 'yes' === $gateway->enabled && call_user_func( $filter, $gateway ); } else { return 'yes' === $gateway->enabled; } } ); return ! empty( $enabled_gateways ); }