Commit 53974671dcd for woocommerce

commit 53974671dcd999d1a559e4d1259d7f8b4a6f4517
Author: Taha Paksu <3295+tpaksu@users.noreply.github.com>
Date:   Mon Nov 2 12:22:24 2026 +0300

    Reset the cached checkout fields so WC_Checkout_Test does not depend on test order (#70378)

    * [WOOPLUG-8134] Reset the cached checkout fields so WC_Checkout_Test does not depend on test order

    * Add changefile(s) from automation for the following project(s): woocommerce

    * [WOOPLUG-8134] Reset the global checkout field cache independently of emptying the cart

    ---------

    Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>

diff --git a/plugins/woocommerce/changelog/70378-wooplug-8134-wc_checkout_test-is-order-dependent-the-global-checkout b/plugins/woocommerce/changelog/70378-wooplug-8134-wc_checkout_test-is-order-dependent-the-global-checkout
new file mode 100644
index 00000000000..cd02a8b4205
--- /dev/null
+++ b/plugins/woocommerce/changelog/70378-wooplug-8134-wc_checkout_test-is-order-dependent-the-global-checkout
@@ -0,0 +1,5 @@
+Significance: patch
+Type: dev
+Comment: Make WC_Checkout_Test independent of test order; no production change.
+
+
diff --git a/plugins/woocommerce/tests/php/includes/class-wc-checkout-test.php b/plugins/woocommerce/tests/php/includes/class-wc-checkout-test.php
index c28903e582e..6e8dda0e6a6 100644
--- a/plugins/woocommerce/tests/php/includes/class-wc-checkout-test.php
+++ b/plugins/woocommerce/tests/php/includes/class-wc-checkout-test.php
@@ -58,6 +58,13 @@ class WC_Checkout_Test extends \WC_Unit_Test_Case {
 		};
 		// phpcs:enable Generic.CodeAnalysis, Squiz.Commenting

+		// WC()->checkout() is a process-global singleton whose get_checkout_fields() caches the
+		// filtered field list on first call and keeps it across tests, so reset it or a test's
+		// woocommerce_checkout_fields filter is ignored once an earlier test has populated the cache.
+		( function () {
+			$this->fields = null;
+		} )->call( WC()->checkout() );
+
 		WC()->cart->empty_cart();

 		$customer                = WC()->customer;