Commit 9a0d4f5c5da for woocommerce
commit 9a0d4f5c5da3c63b555cbdd90621e42204358990
Author: Vladimir Reznichenko <kalessil@gmail.com>
Date: Fri Jul 3 13:28:21 2026 +0200
[Performance] Audit wc_product_dropdown_categories usages in admin (#66202)
Based on #66176, audit the usage of wc_product_dropdown_categories to identify similar unreported cases.
Removes product counters from the brands filter on the products page in admin.
diff --git a/plugins/woocommerce/changelog/performance-audit-wc_product_dropdown_categories-usages-in-admin b/plugins/woocommerce/changelog/performance-audit-wc_product_dropdown_categories-usages-in-admin
new file mode 100644
index 00000000000..fa2852fb6ee
--- /dev/null
+++ b/plugins/woocommerce/changelog/performance-audit-wc_product_dropdown_categories-usages-in-admin
@@ -0,0 +1,4 @@
+Significance: minor
+Type: performance
+
+Audit wc_product_dropdown_categories usages in admin
diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-brands.php b/plugins/woocommerce/includes/admin/class-wc-admin-brands.php
index d35b52eb018..53c0a6fe200 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-brands.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-brands.php
@@ -598,8 +598,6 @@ class WC_Brands_Admin {
if ( $brands_count <= apply_filters( 'woocommerce_product_brand_filter_threshold', 100 ) ) {
wc_product_dropdown_categories(
array(
- 'pad_counts' => true,
- 'show_count' => true,
'orderby' => 'name',
'selected' => $current_brand_slug,
'show_option_none' => __( 'Filter by brand', 'woocommerce' ),
@@ -608,6 +606,10 @@ class WC_Brands_Admin {
'taxonomy' => 'product_brand',
'name' => 'product_brand',
'class' => 'dropdown_product_brand',
+ // Performance note: pad_counts=0 skips the hierarchical count SQL — O(all published products), degrades linearly
+ // with catalog size. show_count=0 suppresses the raw wp_term_taxonomy.count that would otherwise render in its place.
+ 'pad_counts' => 0,
+ 'show_count' => 0,
)
);
} else {