Commit 199ae11127c for woocommerce

commit 199ae11127c6d5dd699fe89e43a3c5c978f01a74
Author: Anand Rajaram <anandrajaram21@gmail.com>
Date:   Sat Jun 20 02:54:48 2026 +0530

    Fix tax country code autocomplete to not be based on full country name (#65879)

    * Round activity panel corners in the home screen

    - Add overflow clipping and border radius rules to activity panel bodies
    - Keep open and collapsed panel corners aligned

    * Sort tax rate country autocomplete matches

    - Replace static country autocomplete data with a ranked search source
    - Prioritize exact and prefix matches in the tax rates country field

    * Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin

    * Remove activity panel body corner rounding

    - Drop custom radius and overflow styles from the homescreen activity panel
    - Let the default panel styling handle open and closed states

    ---------

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

diff --git a/plugins/woocommerce/changelog/65879-40653-country-code b/plugins/woocommerce/changelog/65879-40653-country-code
new file mode 100644
index 00000000000..b041dab19b5
--- /dev/null
+++ b/plugins/woocommerce/changelog/65879-40653-country-code
@@ -0,0 +1,4 @@
+Significance: minor
+Type: fix
+
+Fix tax country code autocomplete to not be based on full country name
\ No newline at end of file
diff --git a/plugins/woocommerce/client/legacy/js/admin/settings-views-html-settings-tax.js b/plugins/woocommerce/client/legacy/js/admin/settings-views-html-settings-tax.js
index ad41f180c85..750271d85cb 100644
--- a/plugins/woocommerce/client/legacy/js/admin/settings-views-html-settings-tax.js
+++ b/plugins/woocommerce/client/legacy/js/admin/settings-views-html-settings-tax.js
@@ -21,6 +21,29 @@
 			$pagination        = $( '#rates-pagination, #rates-bottom-pagination' ),
 			$search_field      = $( '#rates-search .wc-tax-rates-search-field' ),
 			$submit            = $( '.woocommerce-save-button[type=submit]' ),
+			countryAutocompleteSource = function( request, response ) {
+				var term    = request.term.toLowerCase(),
+					matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), 'i' ),
+					matches = $.grep( data.countries, function( country ) {
+						return matcher.test( country.value ) || matcher.test( country.label );
+					} );
+
+				response( _.sortBy( matches, function( country ) {
+					var value = country.value.toLowerCase(),
+						label = country.label.toLowerCase();
+
+					if ( value === term ) {
+						return 0;
+					}
+					if ( 0 === value.indexOf( term ) ) {
+						return 1;
+					}
+					if ( 0 === label.indexOf( term ) ) {
+						return 2;
+					}
+					return 3;
+				} ) );
+			},
 			WCTaxTableModelConstructor = Backbone.Model.extend({
 				changes: {},
 				setRateAttribute: function( rateID, attribute, value ) {
@@ -154,7 +177,7 @@

 					// Initialize autocomplete for countries.
 					this.$el.find( 'td.country input' ).autocomplete({
-						source: data.countries,
+						source: countryAutocompleteSource,
 						minLength: 2
 					});