1

At a little bit of a loss here, just updated a Craft 3 site and I've started getting an error thrown whenever the cart is accessed.

Relevant updates were:

  • CraftCMS 3.7.11 -> 3.7.27.2
  • Craft Commerce 3.4.2 -> 3.4.9
  • Verbb Postie -> 2.4.9 -> 2.4.21

PHP Version is 7.4.19

The error I'm seeing is Object of class craft\commerce\models\ShippingMethod could not be converted to int

We do have a custom module extending postie, but everything was working cleanly before these updates. And the stack trace doesn't point to anything in the module, though that doesn't rule it out. Does anyone know of anything in this batch of updates that could've started throwing this error?

yii\base\ErrorException: Object of class craft\commerce\models\ShippingMethod could not be converted to int in /var/www/sslptest.com/vendor/yiisoft/yii2/helpers/BaseArrayHelper.php:853
Stack trace:
#0 /var/www/sslptest.com/vendor/craftcms/cms/src/web/ErrorHandler.php(87): yii\base\ErrorHandler->handleError(8, 'Object of class...', '/var/www/sslpte...', 853)
#1 [internal function]: craft\web\ErrorHandler->handleError(8, 'Object of class...', '/var/www/sslpte...', 853, Array)
#2 /var/www/sslptest.com/vendor/yiisoft/yii2/helpers/BaseArrayHelper.php(853): in_array(349, Array, false)
#3 /var/www/sslptest.com/vendor/craftcms/commerce/src/elements/Order.php(1899): yii\helpers\BaseArrayHelper::isIn(349, Array)
#4 /var/www/sslptest.com/vendor/craftcms/commerce/src/elements/Order.php(1852): craft\commerce\elements\Order->getAvailableShippingMethodOptions()
#5 /var/www/sslptest.com/vendor/craftcms/commerce/src/elements/Order.php(1940): craft\commerce\elements\Order->recalculate()
#6 /var/www/sslptest.com/vendor/craftcms/cms/src/services/Elements.php(2728): craft\commerce\elements\Order->afterSave(false)
#7 /var/www/sslptest.com/vendor/craftcms/cms/src/services/Elements.php(785): craft\services\Elements->_saveElementInternal(Object(craft\commerce\elements\Order), false, false, true)
#8 /var/www/sslptest.com/vendor/craftcms/commerce/src/controllers/CartController.php(407): craft\services\Elements->saveElement(Object(craft\commerce\elements\Order), false, false, true)
#9 /var/www/sslptest.com/vendor/craftcms/commerce/src/controllers/CartController.php(243): craft\commerce\controllers\CartController->_returnCart()
#10 [internal function]: craft\commerce\controllers\CartController->actionUpdateCart()
#11 /var/www/sslptest.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /var/www/sslptest.com/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#13 /var/www/sslptest.com/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('update-cart', Array)
#14 /var/www/sslptest.com/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction('commerce/cart/u...', Array)
#15 /var/www/sslptest.com/vendor/craftcms/cms/src/web/Application.php(602): craft\web\Application->runAction('commerce/cart/u...', Array)
#16 /var/www/sslptest.com/vendor/craftcms/cms/src/web/Application.php(272): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#17 /var/www/sslptest.com/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#18 /var/www/sslptest.com/public/index.php(22): yii\base\Application->run()
#19 {main}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.