Automattic\WooCommerce\Admin\Features
Features::get_available_features
Gets a build configured array of enabled WooCommerce Admin respecting optionally disabled features.
Method of the class: Features{}
Hooks from the method
Returns
array. Enabled Woocommerce Admin features/sections.
Usage
$result = Features::get_available_features();
Features::get_available_features() Features::get available features code WC 11.1.2
public static function get_available_features() {
$features = self::get_features_with_legacy_compatibility_defaults();
$optional_feature_keys = array( 'analytics', 'remote-inbox-notifications' );
$legacy_compatibility_values = self::get_legacy_feature_compatibility_values();
$unavailable_features = array();
$available_compatibility_keys = array_keys( array_filter( $legacy_compatibility_values ) );
$features = array_values( array_unique( array_merge( $features, $available_compatibility_keys ) ) );
/**
* Filter allowing WooCommerce Admin optional features to be disabled.
*
* @param bool $disabled False.
*/
if ( apply_filters( 'woocommerce_admin_disabled', false ) ) {
return array_values( array_diff( $features, $optional_feature_keys ) );
}
if (
in_array( 'analytics', $features, true ) &&
! self::is_analytics_enabled()
) {
$unavailable_features[] = 'analytics';
}
if (
in_array( 'remote-inbox-notifications', $features, true ) &&
'yes' !== get_option( RemoteInboxNotifications::TOGGLE_OPTION_NAME, 'yes' )
) {
$unavailable_features[] = 'remote-inbox-notifications';
}
return array_values( array_diff( $features, $unavailable_features ) );
}