During a test order in our Magento shop, the following error message appears in the order confirmation: CSS Inline Error: DOMXPath::query(): Invalid expression in selector >> div.block-minicart .minicart-items .product-item:not(:first-child) << in vendor/pelago/emogrifier/Classes/Emogrifier.php on line 372.
The problem was caused by the Emogrifier tool. Emogrifier converts CSS code into inline HTML styling, for example in email templates. Some selectors used in our LESS files are not supported by “pelago/emogrifier”. However, the problem could not be reproduced on localhost because the LESS files were compiled differently there. A possible solution can be found here:
https://github.com/magento/magento2/issues/4737
Two overrides of the LESS files that style the email templates need to be created:
/vendor/magento/theme-frontend-blank/web/css/email.less
/vendor/magento/theme-frontend-blank/web/css/email-inline.css
The overrides are stored in the following directories:
app/design/frontend/our-theme/default/web/css/email.less
and
app/design/frontend/our-theme/default/web/css/email-inline.less
The following line must be removed or commented out in each override:
"@import 'source/_theme.less';"
