attribute_orderby ) {
case 'name' :
@@ -403,9 +407,7 @@ class WC_Admin_Attributes {
* `product_attributes_type_selector` filter. If there is only the default type registered,
* this setting will be hidden.
*/
- $attribute_types = wc_get_attribute_types();
-
- if ( 1 < count( $attribute_types ) || ! array_key_exists( 'select', $attribute_types ) ) {
+ if ( wc_has_custom_attribute_types() ) {
?>
diff --git a/includes/wc-attribute-functions.php b/includes/wc-attribute-functions.php
index 9fae15240be..250b46cc8e1 100644
--- a/includes/wc-attribute-functions.php
+++ b/includes/wc-attribute-functions.php
@@ -197,6 +197,18 @@ function wc_get_attribute_types() {
) );
}
+/**
+ * Check if there are custom attribute types.
+ *
+ * @since 3.3.2
+ * @return bool True if there are custom types, otherwise false.
+ */
+function wc_has_custom_attribute_types() {
+ $types = wc_get_attribute_types();
+
+ return 1 < count( $types ) || ! array_key_exists( 'select', $types );
+}
+
/**
* Get attribute type label.
*