Commit 0fb2a1ba7af for woocommerce
commit 0fb2a1ba7afca1ec1c2df7fd320c5a720f57f457
Author: Bhavik Kalpesh <53536925+bhavz-10@users.noreply.github.com>
Date: Thu Mar 12 20:52:08 2026 +0530
Wrong escaping of "&" character in product name in img alt tag in cart and checkout pages (#63637)
* fix: ( cart ) decode fallbackAlt using decodeEntities to ensure proper HTML escaping in image alt attribute
* docs: add changelog file
* feat: reduce decodeEntities multiple calls
* fix: resolve js linting issue
diff --git a/plugins/woocommerce/changelog/fix-63574-wrong-escaping-in-image-alt-in-cart b/plugins/woocommerce/changelog/fix-63574-wrong-escaping-in-image-alt-in-cart
new file mode 100644
index 00000000000..9d13bac0ee8
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-63574-wrong-escaping-in-image-alt-in-cart
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Wrong escaping of "&" character in product name in img alt tag in cart and checkout pages
diff --git a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/product-image/index.tsx b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/product-image/index.tsx
index 4882bdd2b95..af6dc1ad95d 100644
--- a/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/product-image/index.tsx
+++ b/plugins/woocommerce/client/blocks/assets/js/base/components/cart-checkout/product-image/index.tsx
@@ -23,13 +23,12 @@ const ProductImage = ( {
width,
height,
}: ProductImageProps ): JSX.Element => {
+ const rawAlt = image.alt || fallbackAlt;
+
const imageProps = image.thumbnail
? {
src: image.thumbnail,
- alt:
- decodeEntities( image.alt ) ||
- fallbackAlt ||
- 'Product Image',
+ alt: rawAlt ? decodeEntities( rawAlt ) : 'Product Image',
}
: {
src: PLACEHOLDER_IMG_SRC,