Commit 2afbf71e14a for woocommerce

commit 2afbf71e14a91b2f78299694cadcb46d8bfe784a
Author: Bhavik Tank <53536925+bhavz-10@users.noreply.github.com>
Date:   Fri May 1 22:34:32 2026 +0530

    Clear transients does not clear transient_wc_attribute_taxonomies (#64240)

    * feat: add delete transient and clear cache for wc_attribute_taxonomies

    * fix: linting issues

    * feat: add changelog file

    * feat: add cache invalidation

    * chore: drop unreachable method_exists fallback for invalidate_cache_group

    * chore: refresh PHPStan baseline after merging trunk

    ---------

    Co-authored-by: Brandon Kraft <public@brandonkraft.com>

diff --git a/plugins/woocommerce/changelog/fix-63774-clear-transients-does-not-clear-transient_wc_attribute_taxonomies b/plugins/woocommerce/changelog/fix-63774-clear-transients-does-not-clear-transient_wc_attribute_taxonomies
new file mode 100644
index 00000000000..d9f030e4ba2
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-63774-clear-transients-does-not-clear-transient_wc_attribute_taxonomies
@@ -0,0 +1,4 @@
+Significance: patch
+Type: add
+
+Add the logic to clear "wc_attribute_taxonomies" transient and cache when clicking on "clear transients".
diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php
index 6c21fb4eea7..5685b31055f 100644
--- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php
+++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php
@@ -474,6 +474,10 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller {
 					}
 				}

+				delete_transient( 'wc_attribute_taxonomies' );
+
+				WC_Cache_Helper::invalidate_cache_group( 'woocommerce-attributes' );
+
 				WC_Cache_Helper::get_transient_version( 'shipping', true );

 				wc_get_container()->get( CacheController::class )->delete_filter_data_transients();
diff --git a/plugins/woocommerce/tests/php/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller-test.php b/plugins/woocommerce/tests/php/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller-test.php
index d85cc6d5401..8d2950e0349 100644
--- a/plugins/woocommerce/tests/php/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller-test.php
+++ b/plugins/woocommerce/tests/php/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller-test.php
@@ -114,4 +114,35 @@ class WC_REST_System_Status_Tools_V2_Controller_Test extends WC_REST_Unit_Test_C

 		$this->cleanup_data_for_expired_download_permissions_test();
 	}
+
+	/**
+	 * @testdox Clear transients tool clears the wc_attribute_taxonomies transient and invalidates the woocommerce-attributes cache group.
+	 */
+	public function test_execute_tool_clear_transients() {
+		wp_set_current_user( $this->user );
+
+		// Set up the transient to be cleared with a proper attribute taxonomy object.
+		$mock_attribute                  = new stdClass();
+		$mock_attribute->attribute_id    = 123;
+		$mock_attribute->attribute_name  = 'test_attr';
+		$mock_attribute->attribute_label = 'Test Attr';
+		set_transient( 'wc_attribute_taxonomies', array( $mock_attribute ) );
+
+		$prefix_before = WC_Cache_Helper::get_cache_prefix( 'woocommerce-attributes' );
+
+		$response = $this->server->dispatch( new WP_REST_Request( 'PUT', '/wc/v2/system_status/tools/clear_transients' ) );
+
+		$this->assertEquals( 200, $response->get_status() );
+
+		$response_data = $response->get_data();
+		$this->assertTrue( $response_data['success'] );
+		$this->assertStringContainsString( 'transients', $response_data['message'], 'Message should mention transients being cleared' );
+
+		// Verify the transient was deleted.
+		$this->assertFalse( get_transient( 'wc_attribute_taxonomies' ) );
+
+		// Verify the woocommerce-attributes cache group was invalidated by checking that the prefix changed.
+		$prefix_after = WC_Cache_Helper::get_cache_prefix( 'woocommerce-attributes' );
+		$this->assertNotEquals( $prefix_before, $prefix_after, 'Cache prefix should have changed after invalidation' );
+	}
 }