WordPress multilanguage text using code with PolyLang

Solution:

I don’t have much experience with polylang, but you could probably achieve this by using polylang pll_current_language() function, like this:

if (pll_current_language() == 'en') {
  echo "Product has been added to your cart";
} else if (pll_current_language() == 'de') {
  echo "Text in german";
}