Back to Global Site
Latest Topics Top Commented

\"product is already in cart\" button translation

PrestaShop
Y

Hello

I\'ve found your great tutorial for changing the \"add to cart\" button text after adding product to cart under

https://myprestamodules.com/blog/prestashop-17/mark-product-is-already-in-cart-in-prestashop-17.html

It works tremendously!

But I\'ve got a problem with translation of the text as the store has 3 languages.

Basically translation for \"Add to cart\" text works by default, but \"Already in cart\" stays in english for all languages.
Could you give me a hint how can can I add translation for this phrase?

0
O

Hi,

You can translate in PrestaShop theme translations.

Regards

0
Y
Oleksandr

You can translate in PrestaShop theme translations.

ohhh thanks a bunch!
I'm so glad you pointed me to this solution, I didn't know that phrases used in theme's template can be translated in backend so easily.

But after implementing all changes, and testing I've found one issue.
When a product contains attributes, for example trousers having different size ( S/M/L/XL...) switching the attribute doesn't revert the label to default "add to cart".

Is it somehow possible to add a condition that would also handle product attributes?

0
Y

After dumping some product information I think I have found what I was looking for.
TL;DR for those who seek solution, this should do:

 {if $cart_product['id_product'] == $product.id && $cart_product['id_product_attribute'] == $product.id_product_attribute}

0
Leave a Reply to This Topic
Created by
Y
2021-12-16
Last reply
Y
16 December, 18:17
Total Replies
3