WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Admin_Dashboard_Setup::populate_payment_tasks() private WC 1.0

Populate payment tasks's visibility and completion

{} Это метод класса: WC_Admin_Dashboard_Setup{}

Хуков нет.

Возвращает

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->populate_payment_tasks();

Код WC_Admin_Dashboard_Setup::populate_payment_tasks() WC 5.4.1

<?php
private function populate_payment_tasks() {
	$is_woo_payment_installed = is_plugin_active( 'woocommerce-payments/woocommerce-payments.php' );
	$country                  = explode( ':', get_option( 'woocommerce_default_country', 'US:CA' ) )[0];

	// woocommerce-payments requires its plugin activated and country must be US.
	if ( ! $is_woo_payment_installed || 'US' !== $country ) {
		unset( $this->tasks['woocommerce-payments'] );
	}

	// payments can't be used when woocommerce-payments exists and country is US.
	if ( $is_woo_payment_installed && 'US' === $country ) {
		unset( $this->tasks['payments'] );
	}

	if ( isset( $this->tasks['payments'] ) ) {
		$gateways                             = WC()->payment_gateways->get_available_payment_gateways();
		$enabled_gateways                     = array_filter(
			$gateways,
			function ( $gateway ) {
				return 'yes' === $gateway->enabled;
			}
		);
		$this->tasks['payments']['completed'] = ! empty( $enabled_gateways );
	}

	if ( isset( $this->tasks['woocommerce-payments'] ) ) {
		$wc_pay_is_connected = false;
		if ( class_exists( '\WC_Payments' ) ) {
			$wc_payments_gateway = \WC_Payments::get_gateway();
			$wc_pay_is_connected = method_exists( $wc_payments_gateway, 'is_connected' )
				? $wc_payments_gateway->is_connected()
				: false;
		}
		$this->tasks['woocommerce-payments']['completed'] = $wc_pay_is_connected;
	}
}