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.