I'm trying to translate the "You added ... to your shopping cart." line in my Magento 2 installation.
I have already a .csv file in: "app/design/themevendor/themename/i18n/" with all the lines translated, and I have also translated the lines into "vendor/magento/module-checkout/Controller/Cart/Add.php" but the line that comes out when you add a to cart a product is still in English!

Also, this line has the last part, "shopping cart" as a link, the ones I have translated were just normal lines, so I think the one I'm trying to translate, is built from 2 parts, but I just can't find it.

3 Answers 3


if you are using following line in i18n on theme as translation source

"You added %1 to your shopping cart."

then change it to

"You added %1 to your <a href=""%2"">shopping cart</a>."

Example :

"You added %1 to your <a href=""%2"">shopping cart</a>.","Du lade %1 in din <a href=""%2"">varukorg</a>"

Instead of

"You added %1 to your shopping cart.","Du lade %1 in din varukorg"

I have actually managed to find the solution myself, the right file to edit is: "vendor/magento/module-checkout/view/frontend/templates/messages/addCartSuccessMessage.phtml"


@alexcr, that file should be extended in app/design/CUSTOM/THEME/Magento_Checkout/templates/messages/AddCartSuccessMessage.phtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.