Magento 2 - Product names with special characters
-
11-01-2021 - |
Question
Products having special characters like TM
, I am importing products using ™
for TM
, it appears as expected on product detail and listing page. But when the product is added to cart, in mini-cart I see ™
string instead of TM
.
How can I import or create products with the product name containing special characters in Magento 2
?
Solution
You need to override some file to resolve this:
copy this file in your theme:
vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html
Magento rendering your product name as text <a data-bind="attr: {href: product_url}, text: product_name"></a>
. You can change it from text
to html
like this <a data-bind="attr: {href: product_url}, html: product_name"></a>
.
Maybe you are facing same on the checkout page in the summary section you need to do same for that but with this file.
vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html
From <strong class="product-item-name" data-bind="text: $parent.name"></strong>
To <strong class="product-item-name" data-bind="html: $parent.name"></strong>
.