WC_Marketplace_Suggestions::allow_suggestions()public staticWC 1.0

Should suggestions be displayed?

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

Хуки из метода

Возвращает

true|false.

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

$result = WC_Marketplace_Suggestions::allow_suggestions();

Код WC_Marketplace_Suggestions::allow_suggestions() WC 8.7.0

public static function allow_suggestions() {
	// We currently only support English suggestions.
	$locale             = get_locale();
	$suggestion_locales = array(
		'en_AU',
		'en_CA',
		'en_GB',
		'en_NZ',
		'en_US',
		'en_ZA',
	);
	if ( ! in_array( $locale, $suggestion_locales, true ) ) {
		return false;
	}

	// Suggestions are only displayed if user can install plugins.
	if ( ! current_user_can( 'install_plugins' ) ) {
		return false;
	}

	// Suggestions may be disabled via a setting under Accounts & Privacy.
	if ( 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) ) {
		return false;
	}

	// User can disabled all suggestions via filter.
	return apply_filters( 'woocommerce_allow_marketplace_suggestions', true );
}