1

The error I'm receiving is: Call to a member function getRenderLanguage() on null

enter image description here

My Code (Edit - simplified):

 $mergeService = new Merger();
 $batchFileName = 'VAT-' . $country . ( $date ? '-' . $date : '');
 foreach ($orders as $order) {
   $orderPdf = Commerce::getInstance()->getPdfs()->renderPdfForOrder($order, '', null);
   $mergeService->addRaw($orderPdf);
 }
 $batchPdf = $mergeService->merge();

2 Answers 2

1

According to the error, the issue is that $pdf is null... so maybe the variable name is wrong, or there's some other upstream issue that's causing $pdf to not exist.

0

I got in touch with Craft support and this was a bug that the Craft Commerce team fixed in Craft v4. They were kind enough to backport the fix to v3. Should work for anyone else moving forward!

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.