Skip to content

Commit

Permalink
Merge pull request #3292 from craftcms/bugfix/pdf-render-method
Browse files Browse the repository at this point in the history
Fixed `renderPdfForOrder()` method error on `null` `$pdf`
  • Loading branch information
nfourtythree authored Oct 13, 2023
2 parents a492947 + eeaa259 commit 259e429
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added the `commerce/gateways/webhook-url` command.
- Fixed a bug where the delete button would be shown for users that do not have permission to delete on the Product edit page. ([#3285](https://github.com/craftcms/commerce/issues/3285))
- Fixed a bug where deleted shipping categories were still available for selection. ([#3272](https://github.com/craftcms/commerce/issues/3272))
- Fixed an error that could occur when rendering a PDF. ([#2633](https://github.com/craftcms/commerce/issues/2633))

## 4.3.0 - 2023-09-13

Expand Down
2 changes: 1 addition & 1 deletion src/services/Pdfs.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public function renderPdfForOrder(Order $order, string $option = '', string $tem
$view = Craft::$app->getView();
$originalLanguage = Craft::$app->language;
$originalFormattingLanguage = Craft::$app->formattingLocale;
$pdfLanguage = $pdf->getRenderLanguage($order);
$pdfLanguage = $pdf?->getRenderLanguage($order) ?? $originalLanguage;

// TODO add event
Locale::switchAppLanguage($pdfLanguage);
Expand Down

0 comments on commit 259e429

Please sign in to comment.