Commit 81913c90e97 for woocommerce
commit 81913c90e97991f5f0dde677cdab7694fac6d516
Author: Luigi Teschio <gigitux@gmail.com>
Date: Mon Nov 23 09:36:42 2026 +0100
Read variation attribute values as text on the product page (#71233)
(cherry picked from commit 9175f181481d5d69fc293b8214bae3d48d093f60)
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
diff --git a/plugins/woocommerce/client/legacy/js/frontend/add-to-cart-variation.js b/plugins/woocommerce/client/legacy/js/frontend/add-to-cart-variation.js
index 2d951fee296..4a71c6cb333 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/add-to-cart-variation.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/add-to-cart-variation.js
@@ -563,10 +563,10 @@
}
if ( attr_val ) {
- // Decode entities.
- attr_val = $( '<div/>' )
- .html( attr_val )
- .text();
+ // Decode entities without parsing tags. A textarea's content is plain text.
+ var decoder = document.createElement( 'textarea' );
+ decoder.innerHTML = attr_val;
+ attr_val = decoder.value;
// Attach to matching options by value. This is done to compare
// TEXT values rather than any HTML entities.