Answers.Body: <p>I think I figured out the problem. This was my first time switching to the project.yaml configuration Deleting and rebuilding the project config allowed me to change the Commerce &gt; System Settings &gt; Email &gt; Language which fixed the error.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-28T05:31:48.883Z
Answers.Text: Thank you! Nothing worse than updating your production site only to see customers charged and order fail. Ugh. Thanks again. FYI... might want to mark your answer as solved.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-18T18:13:44.320Z
Answers.LastActivityDate: 2021-01-18T18:13:44.320Z
Answers.UserDisplayName: Jack
Body: <p>I just pushed an update to the latest version of craft cms and craft commerce and ran into an error that is blocking new orders from finalizing.</p>
  <p>Everything works on the local site. On the live site, attempting to place a new order throws a 500 error and doesn't complete the order or send a confirmation email. The payment, however, does go through.</p>
  <p>In the web.log I can only find this error:</p>
  <pre><code>2021-01-17 18:00:08 [-][5709][d3ac37ae1b5d01a8535b021ef5e5a0b0][error][TypeError] TypeError: Return value of craft\commerce\models\Email::getRenderLanguage() must be of the type string, null returned in /home/okaytype/craft/vendor/craftcms/commerce/src/models/Email.php:117
  Stack trace:
  #0 /home/okaytype/craft/vendor/craftcms/commerce/src/services/OrderStatuses.php(440): craft\commerce\models\Email-&gt;getRenderLanguage(Object(craft\commerce\elements\Order))
  #1 /home/okaytype/craft/vendor/craftcms/commerce/src/services/OrderHistories.php(127): craft\commerce\services\OrderStatuses-&gt;statusChangeHandler(Object(craft\commerce\elements\Order), Object(craft\commerce\models\OrderHistory))
  #2 /home/okaytype/craft/vendor/craftcms/commerce/src/elements/Order.php(1971): craft\commerce\services\OrderHistories-&gt;createOrderHistoryFromOrder(Object(craft\commerce\elements\Order), NULL)
  #3 /home/okaytype/craft/vendor/craftcms/cms/src/services/Elements.php(2454): craft\commerce\elements\Order-&gt;afterSave(false)
  #4 /home/okaytype/craft/vendor/craftcms/cms/src/services/Elements.php(755): craft\services\Elements-&gt;_saveElementInternal(Object(craft\commerce\elements\Order), false, false, true)
  #5 /home/okaytype/craft/vendor/craftcms/commerce/src/elements/Order.php(1576): craft\services\Elements-&gt;saveElement(Object(craft\commerce\elements\Order), false)
  #6 /home/okaytype/craft/vendor/craftcms/commerce/src/controllers/OrdersController.php(221): craft\commerce\elements\Order-&gt;markAsComplete()
  #7 [internal function]: craft\commerce\controllers\OrdersController-&gt;actionSave()
  #8 /home/okaytype/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  #9 /home/okaytype/craft/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction-&gt;runWithParams(Array)
  #10 /home/okaytype/craft/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller-&gt;runAction('save', Array)
  #11 /home/okaytype/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&gt;runAction('save', Array)
  #12 /home/okaytype/craft/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module-&gt;runAction('commerce/orders...', Array)
  #13 /home/okaytype/craft/vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application-&gt;runAction('commerce/orders...', Array)
  #14 /home/okaytype/craft/vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application-&gt;_processActionRequest(Object(craft\web\Request))
  #15 /home/okaytype/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
  #16 /home/okaytype/craft/web/index.php(42): yii\base\Application-&gt;run()
  #17 {main}
  2021-01-17 18:00:07 [-][5709][d3ac37ae1b5d01a8535b021ef5e5a0b0][info][application] $_GET = [
      'p' =&gt; 'adminbuttstuff/commerce/orders/39536'
  ]
  </code></pre>
  <p>It seems like Craft is looking for a language value of some kind but I can't figure out where or how to provide it.</p>
  <p>I've tried editing the settings in Commerce &gt; System Settings &gt; Email &gt; Language to English, but it always reverts to &quot;The language the order was made.&quot;, which is also English.</p>
  <p>Update: I can get an order to finalize if I turn off the email confirmation. This makes me think there is a problem with the email template, but I'm not getting a system error not a twig error. My email template doesn't use a $language variable anywhere.</p>
  <p>Any help would be hugely appreciated. Thanks.</p>
  
Tags: <error-message><emails><updates><order><plugin-craftcommerce3>
Title: Commerce new order error : mail::getRenderLanguage() must be of the type string
ThreadText: # Commerce new order error : mail::getRenderLanguage() must be of the type string
  
  (Asked by: username_0 on 2021-01-18)
  
  I just pushed an update to the latest version of craft cms and craft commerce and ran into an error that is blocking new orders from finalizing.
  
  Everything works on the local site. On the live site, attempting to place a new order throws a 500 error and doesn't complete the order or send a confirmation email. The payment, however, does go through.
  
  In the web.log I can only find this error:
  
  ```
  2021-01-17 18:00:08 [-][5709][d3ac37ae1b5d01a8535b021ef5e5a0b0][error][TypeError] TypeError: Return value of craft\commerce\models\Email::getRenderLanguage() must be of the type string, null returned in /home/okaytype/craft/vendor/craftcms/commerce/src/models/Email.php:117
  Stack trace:
  #0 /home/okaytype/craft/vendor/craftcms/commerce/src/services/OrderStatuses.php(440): craft\commerce\models\Email->getRenderLanguage(Object(craft\commerce\elements\Order))
  #1 /home/okaytype/craft/vendor/craftcms/commerce/src/services/OrderHistories.php(127): craft\commerce\services\OrderStatuses->statusChangeHandler(Object(craft\commerce\elements\Order), Object(craft\commerce\models\OrderHistory))
  #2 /home/okaytype/craft/vendor/craftcms/commerce/src/elements/Order.php(1971): craft\commerce\services\OrderHistories->createOrderHistoryFromOrder(Object(craft\commerce\elements\Order), NULL)
  #3 /home/okaytype/craft/vendor/craftcms/cms/src/services/Elements.php(2454): craft\commerce\elements\Order->afterSave(false)
  #4 /home/okaytype/craft/vendor/craftcms/cms/src/services/Elements.php(755): craft\services\Elements->_saveElementInternal(Object(craft\commerce\elements\Order), false, false, true)
  #5 /home/okaytype/craft/vendor/craftcms/commerce/src/elements/Order.php(1576): craft\services\Elements->saveElement(Object(craft\commerce\elements\Order), false)
  #6 /home/okaytype/craft/vendor/craftcms/commerce/src/controllers/OrdersController.php(221): craft\commerce\elements\Order->markAsComplete()
  #7 [internal function]: craft\commerce\controllers\OrdersController->actionSave()
  #8 /home/okaytype/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
  #9 /home/okaytype/craft/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
  #10 /home/okaytype/craft/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('save', Array)
  #11 /home/okaytype/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save', Array)
  #12 /home/okaytype/craft/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('commerce/orders...', Array)
  #13 /home/okaytype/craft/vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application->runAction('commerce/orders...', Array)
  #14 /home/okaytype/craft/vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application->_processActionRequest(Object(craft\web\Request))
  #15 /home/okaytype/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
  #16 /home/okaytype/craft/web/index.php(42): yii\base\Application->run()
  #17 {main}
  2021-01-17 18:00:07 [-][5709][d3ac37ae1b5d01a8535b021ef5e5a0b0][info][application] $_GET = [
      'p' => 'adminbuttstuff/commerce/orders/39536'
  ]
  
  ```
  
  It seems like Craft is looking for a language value of some kind but I can't figure out where or how to provide it.
  
  I've tried editing the settings in Commerce > System Settings > Email > Language to English, but it always reverts to "The language the order was made.", which is also English.
  
  Update: I can get an order to finalize if I turn off the email confirmation. This makes me think there is a problem with the email template, but I'm not getting a system error not a twig error. My email template doesn't use a $language variable anywhere.
  
  Any help would be hugely appreciated. Thanks.
  
  **Tags:** error-message, emails, updates, order, plugin-craftcommerce3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-01-18. Score: 2 | Accepted answer
  
  I think I figured out the problem. This was my first time switching to the project.yaml configuration Deleting and rebuilding the project config allowed me to change the Commerce > System Settings > Email > Language which fixed the error.
  
  > **Comments:**
  > **username_1**: Thank you! Nothing worse than updating your production site only to see customers charged and order fail. Ugh. Thanks again. FYI... might want to mark your answer as solved.  
  
  ---
  
  