Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

AdditionalPayments::can_view()publicWC 1.0

Task visibility.

Метод класса: AdditionalPayments{}

Хуков нет.

Возвращает

true|false.

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

$AdditionalPayments = new AdditionalPayments();
$AdditionalPayments->can_view();

Код AdditionalPayments::can_view() WC 8.6.1

public function can_view() {
	if ( ! Features::is_enabled( 'payment-gateway-suggestions' ) ) {
		// Hide task if feature not enabled.
		return false;
	}

	if ( null !== $this->can_view_result ) {
		return $this->can_view_result;
	}

	// Show task if woocommerce-payments is connected or if there are any suggested gateways in other category enabled.
	$this->can_view_result = (
		WooCommercePayments::is_connected() ||
		self::has_enabled_other_category_gateways()
	);

	// Early return if task is not visible.
	if ( ! $this->can_view_result ) {
		return false;
	}

	// Show task if there are any suggested gateways in additional category.
	$this->can_view_result = ! empty( self::get_suggestion_gateways( 'category_additional' ) );

	return $this->can_view_result;
}