WC_Marketplace_Suggestions::allow_suggestions
Should suggestions be displayed?
Method of the class: WC_Marketplace_Suggestions{}
Hooks from the method
Returns
true|false.
Usage
$result = WC_Marketplace_Suggestions::allow_suggestions();
WC_Marketplace_Suggestions::allow_suggestions() WC Marketplace Suggestions::allow suggestions code WC 10.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 );
}