{"id":18939503,"date":"2026-06-16T08:17:00","date_gmt":"2026-06-16T08:17:00","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/postcode-validation-issue-for-countries-without-zip-postcode-e-g-uae\/"},"modified":"2026-06-16T08:17:00","modified_gmt":"2026-06-16T08:17:00","slug":"postcode-validation-issue-for-countries-without-zip-postcode-e-g-uae","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/postcode-validation-issue-for-countries-without-zip-postcode-e-g-uae\/","title":{"rendered":"Postcode validation issue for countries without ZIP\/postcode (e.g. UAE)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">we found an issue related to postcode validation when using WooCommerce Checkout Manager.Scenario<\/p>\n\n\n\n<ul>\n<li>Customer selects <strong>United Arab Emirates<\/strong> as billing\/shipping country.<\/li>\n\n\n\n<li>WooCommerce correctly hides the postcode field because UAE does not use ZIP\/postal codes.<\/li>\n\n\n\n<li>However, when the customer submits the checkout\/payment form, validation fails with an error saying that the postcode is required.<\/li>\n\n\n\n<li>If we temporarily disable the <strong>Required<\/strong> option for the postcode field in WooCommerce Checkout Manager, checkout works as expected.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This suggests that the field is correctly hidden on the frontend according to the country locale, but it is still treated as required during checkout validation.Expected behavior<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If WooCommerce defines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$locale&#091;$country]&#091;'postcode']&#091;'required'] === false<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">then the plugin should automatically skip postcode validation for that country, while keeping postcode required for countries where WooCommerce defines it as mandatory.Possible approach<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One possible solution could be to rely on WooCommerce country locale settings (<code>WC()-&gt;countries-&gt;get_country_locale()<\/code>) and dynamically set the required flag for <code>billing_postcode<\/code> and <code>shipping_postcode<\/code> according to the selected country.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We tested a custom filter that adjusts the <code>required<\/code> property based on <code>postcode.required<\/code>, but we did not deploy it because we&#8217;d prefer a plugin-level solution if possible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Could you please investigate whether WooCommerce Checkout Manager is overriding WooCommerce&#8217;s native postcode requirements during checkout validation?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ideally, the fix should:<\/p>\n\n\n\n<ul>\n<li>keep postcode required for countries that use it;<\/li>\n\n\n\n<li>automatically make it optional for countries where WooCommerce sets <code>postcode.required = false<\/code>;<\/li>\n\n\n\n<li>avoid hardcoded country exceptions where possible.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"template":"","class_list":["post-18939503","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18939503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18939503\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18939503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}