Getting following error in magento 2 email.

CSS inlining error: Warning: DOMXPath::query(): Invalid expression in /home/patios/public_html/vendor/pelago/emogrifier/Classes/Emogrifier.php on line 294 

I have already tried to update pelado vendor. But still getting error.

"pelago/emogrifier": "1.0.0 as 0.1.1"

My magento version is 2.2.1


Before upgrading pelago to to 1.0.0, error was like following...

Warning: DOMXPath::query(): Invalid expression in /home/public_html/vendor/pelago/emogrifier/Classes/Emogrifier.php on line 269

Warning: Invalid argument supplied for foreach() in /home/public_html/vendor/pelago/emogrifier/Classes/Emogrifier.php on line 272
  • what is your php version ? May 2 '19 at 13:49
  • just downgrade the php version 7.3 to 7.2 every thing is working fine May 2 '19 at 14:01

Magento email will import some default less files.

So, if we added some unsupported selectors to these files, that may cause this issue: Order mail confirmation generates DOMXPath::query() error

Reference CSS error in email template in magento 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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