Commit 23d1d8f0ec for woocommerce
commit 23d1d8f0ec2dda88c8e3512d26097a0d1a6b890f
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date: Fri Apr 25 17:07:42 2025 +0100
Add 'id' attribute to settings of type 'single_select_country' (#57247)
* Make sure fields of type 'single_select_country' have an 'id' attribute.
* Add changelog
diff --git a/plugins/woocommerce/changelog/fix-55190 b/plugins/woocommerce/changelog/fix-55190
new file mode 100644
index 0000000000..ea1a7f7a55
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-55190
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Add 'id' attribute for fields of type 'single_select_country'.
diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-settings.php b/plugins/woocommerce/includes/admin/class-wc-admin-settings.php
index fea99c6807..aa59b79d2c 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-settings.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-settings.php
@@ -726,7 +726,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo $tooltip_html; // WPCS: XSS ok. ?></label>
</th>
- <td class="forminp"><select name="<?php echo esc_attr( $value['field_name'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" data-placeholder="<?php esc_attr_e( 'Choose a country / region…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country / Region', 'woocommerce' ); ?>" class="wc-enhanced-select">
+ <td class="forminp"><select name="<?php echo esc_attr( $value['field_name'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" data-placeholder="<?php esc_attr_e( 'Choose a country / region…', 'woocommerce' ); ?>" aria-label="<?php esc_attr_e( 'Country / Region', 'woocommerce' ); ?>" class="wc-enhanced-select">
<?php WC()->countries->country_dropdown_options( $country, $state ); ?>
</select> <?php echo $description; // WPCS: XSS ok. ?>
</td>