Automattic\WooCommerce\Internal\Admin

WcPaySubscriptionsPage::is_store_experiment_eligible()privateWC 1.0

Returns true if the store is eligible for the WooCommerce subscriptions empty state experiment.

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

Хуков нет.

Возвращает

true|false.

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

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

Код WcPaySubscriptionsPage::is_store_experiment_eligible() WC 6.6.1

private function is_store_experiment_eligible() {
	// Ineligible if WooCommerce Payments OR an existing subscriptions plugin is installed.
	$installed_plugins      = PluginsHelper::get_installed_plugin_slugs();
	$plugin_ineligible_list = array(
		'woocommerce-payments',
		'woocommerce-subscriptions',
		'subscriptio',
		'subscriptions-for-woocommerce',
		'subscriptions-for-woocommerce-pro',
		'sumosubscriptions',
		'yith-woocommerce-subscription',
		'xa-woocommerce-subscriptions',
	);
	foreach ( $plugin_ineligible_list as $plugin_slug ) {
		if ( in_array( $plugin_slug, $installed_plugins, true ) ) {
			return false;
		}
	}

	// Ineligible if store address is not compatible with WCPay Subscriptions (US).
	$store_base_location = wc_get_base_location();
	if ( empty( $store_base_location['country'] ) || 'US' !== $store_base_location['country'] ) {
		return false;
	}

	// Ineligible if store has not been active for at least 6 months.
	if ( ! WCAdminHelper::is_wc_admin_active_in_date_range( 'month-6+' ) ) {
		return false;
	}

	// Ineligible if store has not had any sales in the last 30 days.
	if ( ! $this->get_store_recent_sales_eligibility() ) {
		return false;
	}

	return true;
}