Commit fd85aaa2bf0 for woocommerce
commit fd85aaa2bf069739dd26fe90cd18f89b7c7c2cac
Author: Tung Du <dinhtungdu@gmail.com>
Date: Mon Jul 13 12:10:59 2026 +0700
Fix: ensure dropdown render label with special characters correctly (#66453)
fix: ensure dropdown render label with special characters correctly
diff --git a/plugins/woocommerce/changelog/wooplug-7021-ai-regression-reviewrelease110-decoding-term-names-upstream b/plugins/woocommerce/changelog/wooplug-7021-ai-regression-reviewrelease110-decoding-term-names-upstream
new file mode 100644
index 00000000000..93186f31e98
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-7021-ai-regression-reviewrelease110-decoding-term-names-upstream
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix: ensure the dropdown inside Add to Cart + Options block render special character correctly.
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php b/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php
index 2f535de93f8..b1b3f6425c3 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php
@@ -293,13 +293,14 @@ class VariationSelectorAttribute extends AbstractBlock {
if ( ! is_array( $attribute_term ) || ! isset( $attribute_term['value'], $attribute_term['label'] ) ) {
continue;
}
- $value = (string) $attribute_term['value'];
- $slug = sanitize_title( $value );
- $item = array(
+ $value = (string) $attribute_term['value'];
+ $term_name = wp_specialchars_decode( $attribute_term['label'], ENT_QUOTES );
+ $slug = sanitize_title( $value );
+ $item = array(
'id' => $id_prefix . '-' . $slug,
- 'label' => (string) $attribute_term['label'],
+ 'label' => $term_name,
'value' => $value,
- 'ariaLabel' => (string) $attribute_term['label'],
+ 'ariaLabel' => $term_name,
'selected' => $default_selected === $value,
);
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/Dropdown.php b/plugins/woocommerce/src/Blocks/BlockTypes/Dropdown.php
index 3018b0a2313..fc6bc1c7810 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/Dropdown.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/Dropdown.php
@@ -25,7 +25,7 @@ final class Dropdown extends AbstractBlock {
*/
private function get_option_text( array $item ): string {
if ( isset( $item['label'] ) && is_string( $item['label'] ) ) {
- return wp_strip_all_tags( $item['label'] );
+ return $item['label'];
}
if ( ! empty( $item['ariaLabel'] ) && is_string( $item['ariaLabel'] ) ) {
return $item['ariaLabel'];