Automattic\WooCommerce\Internal\Admin\Settings
PaymentsController::store_has_providers_with_action()
Check if the store has any payment providers that need an action/attention.
This includes gateways that are enabled but not configured (need setup).
Метод класса: PaymentsController{}
Хуков нет.
Возвращает
true|false
. True if the store has enabled gateways that need attention, false otherwise.
Использование
// private - только в коде основоного (родительского) класса $result = $this->store_has_providers_with_action(): bool;
Код PaymentsController::store_has_providers_with_action() PaymentsController::store has providers with action WC 9.6.1
private function store_has_providers_with_action(): bool { try { $providers = $this->payments->get_payment_providers( $this->payments->get_country() ); } catch ( Exception $e ) { // In case of an error, just return false. return false; } // Go through the providers and check if any of them need attention from the user. foreach ( $providers as $provider ) { // Handle payment gateways and offline payment methods that need setup. if ( in_array( $provider['_type'], array( PaymentProviders::TYPE_GATEWAY, PaymentProviders::TYPE_OFFLINE_PM, ), true ) && ! empty( $provider['state']['needs_setup'] ) ) { return true; } // If there are incentives, the provider needs attention. if ( ! empty( $provider['_incentive'] ) ) { return true; } } return false; }