Commit 4f26664c27a for woocommerce

commit 4f26664c27a741090f33aa411149ae9de76d7d9a
Author: SH Sajal Chowdhury <72102985+shsajalchowdhury@users.noreply.github.com>
Date:   Wed May 6 14:44:41 2026 +0600

    Fix categories report filtering when term_id differs from term_taxonomy_id (#64548)

    * Fix categories report filtering when term_id differs from term_taxonomy_id

    * Add changelog entry

    * Update plugins/woocommerce/changelog/pr-64548

    Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>

    ---------

    Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
    Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>

diff --git a/plugins/woocommerce/changelog/pr-64548 b/plugins/woocommerce/changelog/pr-64548
new file mode 100644
index 00000000000..5f29e051606
--- /dev/null
+++ b/plugins/woocommerce/changelog/pr-64548
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix categories report filtering when term_id differs from term_taxonomy_id
diff --git a/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php b/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php
index 1eac07cc3ea..6ad221effc9 100644
--- a/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php
+++ b/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php
@@ -106,7 +106,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {

 		$included_categories = $this->get_included_categories( $query_args );
 		if ( $included_categories ) {
-			$this->subquery->add_sql_clause( 'where', "AND {$wpdb->term_relationships}.term_taxonomy_id IN ({$included_categories})" );
+			$this->subquery->add_sql_clause( 'where', "AND {$wpdb->term_taxonomy}.term_id IN ({$included_categories})" );

 			// Limit is left out here so that the grouping in code by PHP can be applied correctly.
 			// This also needs to be put after the term_taxonomy JOIN so that we can match the correct term name.