Commit 314c17867c6 for woocommerce

commit 314c17867c6143ab2c110e8f4ab524f82ecf49a6
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu Oct 22 12:09:15 2026 +0100

    Fix doc example for removing checkout fields in all countries (#70123)

    The example looped over the existing locale entries, which only cover
    countries with built-in locale settings. Blocks and Store API validation
    fall back to the default fields for every other country, so the fields
    stayed visible and required there. Loop over the countries the store
    sells or ships to instead.

    Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

diff --git a/docs/block-development/extensible-blocks/cart-and-checkout-blocks/removing-checkout-fields.md b/docs/block-development/extensible-blocks/cart-and-checkout-blocks/removing-checkout-fields.md
index 0c5e512a017..b064957067b 100644
--- a/docs/block-development/extensible-blocks/cart-and-checkout-blocks/removing-checkout-fields.md
+++ b/docs/block-development/extensible-blocks/cart-and-checkout-blocks/removing-checkout-fields.md
@@ -131,23 +131,25 @@ As with the above, this is not something we recommend unless you sell to a very

 ```php
 add_filter('woocommerce_get_country_locale', function( $locale ) {
-	foreach ( $locale as $key => $value ) {
-		$locale[ $key ]['address_1'] = [
+	$countries = array_keys( WC()->countries->get_allowed_countries() + WC()->countries->get_shipping_countries() );
+
+	foreach ( $countries as $country ) {
+		$locale[ $country ]['address_1'] = [
 			'required' => false,
 			'hidden'   => true,
 		];

-		$locale[ $key ]['postcode'] = [
+		$locale[ $country ]['postcode'] = [
 			'required' => false,
 			'hidden'   => true,
 		];

-		$locale[ $key ]['city'] = [
+		$locale[ $country ]['city'] = [
 			'required' => false,
 			'hidden'   => true,
 		];

-		$locale[ $key ]['state'] = [
+		$locale[ $country ]['state'] = [
 			'required' => false,
 			'hidden'   => true,
 		];
@@ -157,7 +159,7 @@ add_filter('woocommerce_get_country_locale', function( $locale ) {
 });
 ```

-The above code would loop over all counties you sell and disable the fields there.
+The above code loops over all countries you sell or ship to and disables the fields there. Looping over `$locale` instead would skip countries that have no entry in it by default, so those countries would keep their fields.

 ## Limiting changes to virtual carts only