Commit a81665d5a44 for woocommerce

commit a81665d5a44019d7278db9c91f7f8e171abcd3c6
Author: Miguel Gasca <miguel.gasca@automattic.com>
Date:   Thu Sep 10 09:38:17 2026 +0200

    Stop requiring a postcode or state for Qatar at checkout (#68366)

    * Stop requiring a postcode or state for Qatar at checkout

    Qatar has no postal code system — mail is addressed to PO Boxes, and the
    conventional address format is name, PO Box, city, country, with no
    subdivision line. WooCommerce also ships no subdivision list for Qatar, so
    the state field was a required free-text box with nothing to guide it.

    With no locale entry, Qatar fell through to the default, which marks both
    postcode and state required. Shoppers had to invent filler to place an
    order; the originating support ticket reports a customer entering 0 as the
    postcode, which then bypassed the merchant's table rate shipping zones.

    Add a QA entry hiding the postcode and making the state optional, matching
    the AE entry the reported issue asked to mirror. Classic and block checkout
    both read this locale, and Store API validation already skips fields that
    are hidden or not required, so the single entry covers both.

diff --git a/plugins/woocommerce/changelog/qatar-postcode-not-required b/plugins/woocommerce/changelog/qatar-postcode-not-required
new file mode 100644
index 00000000000..6df73ed2532
--- /dev/null
+++ b/plugins/woocommerce/changelog/qatar-postcode-not-required
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Hide the postcode field and make the state optional for Qatar at checkout.
diff --git a/plugins/woocommerce/includes/class-wc-countries.php b/plugins/woocommerce/includes/class-wc-countries.php
index 26edf042857..44b14d4897b 100644
--- a/plugins/woocommerce/includes/class-wc-countries.php
+++ b/plugins/woocommerce/includes/class-wc-countries.php
@@ -1543,6 +1543,15 @@ class WC_Countries {
 							'label' => __( 'Department', 'woocommerce' ),
 						),
 					),
+					'QA' => array(
+						'postcode' => array(
+							'required' => false,
+							'hidden'   => true,
+						),
+						'state'    => array(
+							'required' => false,
+						),
+					),
 					'RE' => array(
 						'state' => array(
 							'required' => false,
diff --git a/plugins/woocommerce/tests/php/includes/class-wc-countries-test.php b/plugins/woocommerce/tests/php/includes/class-wc-countries-test.php
index f7676112a37..fc7c4f54f06 100644
--- a/plugins/woocommerce/tests/php/includes/class-wc-countries-test.php
+++ b/plugins/woocommerce/tests/php/includes/class-wc-countries-test.php
@@ -498,6 +498,20 @@ class WC_Countries_Test extends \WC_Unit_Test_Case {
 		$this->assertArrayNotHasKey( 'hidden', $fields['billing_postcode'] );
 	}

+	/**
+	 * @testdox 'get_address_fields' hides the postcode and makes the state optional for Qatar, matching the UAE.
+	 *
+	 * @return void
+	 */
+	public function test_get_address_fields_relaxes_postcode_and_state_for_qatar() {
+		$fields = ( new WC_Countries() )->get_address_fields( 'QA', 'billing_' );
+
+		$this->assertTrue( $fields['billing_postcode']['hidden'] ?? false, 'Qatar addresses have no postcode, so the field should be hidden.' );
+		$this->assertFalse( $fields['billing_postcode']['required'], 'Qatar addresses have no postcode, so the field should not be required.' );
+		$this->assertFalse( $fields['billing_state']['required'], 'WooCommerce lists no subdivisions for Qatar, so the state should not be required.' );
+		$this->assertFalse( $fields['billing_state']['hidden'] ?? false, 'Qatar follows the UAE, which keeps the state visible rather than hiding it like Bahrain and Kuwait.' );
+	}
+
 	/**
 	 * Provider for `test_get_country_from_alpha_3_code`.
 	 *