craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
219 stars 170 forks source link

[4.x]: Calling unknown method: craft\web\twig\variables\CraftVariable::commerce() after upgrading to Craft Commerce 4.6.2 #3533

Closed ax2000 closed 3 months ago

ax2000 commented 3 months ago

What happened?

Description

After upgrading from Commerce 4.6.1 to 4.6.2 and Craft from 4.9.5 to 4.9.7 I get the following error when clicking on the Commerce menu item in the Craft CP.

Twig\Error\RuntimeError: Calling unknown method: craft\web\twig\variables\CraftVariable::commerce() in /var/www/html/vendor/craftcms/commerce/src/templates/index.twig:8
Stack trace:
#0 /var/www/html/storage/runtime/compiled_templates/85/85184c912026c3068e35c39e61c838a1.php(40): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\CraftVariable), 'commerce', Array, 'any', false, false, false, 8)
#1 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_1c6e1d16bebad9e79a1205230b9ab795->doDisplay(Array, Array)
#2 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#3 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#4 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#5 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render(Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render('commerce/index', Array)
#7 /var/www/html/vendor/craftcms/cms/src/web/View.php(535): craft\web\View->renderTemplate('commerce/index', Array)
#8 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate('commerce/index', Array, 'cp')
#9 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1100): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#10 /var/www/html/vendor/craftcms/cms/src/web/Response.php(338): yii\web\Response->prepare()
#11 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#12 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#13 /var/www/html/public_html/index.php(12): yii\base\Application->run()
#14 {main}

Screenshot 2024-06-06 at 16 08 15

It's like something went wrong with the update but I can't be sure. No errors appeared when performind the update via the command line: Screenshot 2024-06-06 at 16 12 41

Also, just checked the Dashboard and getting the same error:

Twig\Error\RuntimeError: Calling unknown method: craft\web\twig\variables\CraftVariable::commerce() in /var/www/html/vendor/craftcms/commerce/src/templates/_components/widgets/orders/average/body.twig:3
Stack trace:
#0 /var/www/html/storage/runtime/compiled_templates/b1/b10bac9f17c90e74352bb2b3ac857e9a.php(44): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\twig\variables\CraftVariable), 'commerce', Array, 'any', false, false, false, 3)
#1 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_340b953fba59d2e844beba0948f1fa58->doDisplay(Array, Array)
#2 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#3 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#4 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#5 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render(Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render('commerce/_compo...', Array)
#7 /var/www/html/vendor/craftcms/commerce/src/widgets/AverageOrderTotal.php(97): craft\web\View->renderTemplate('commerce/_compo...', Array)
#8 /var/www/html/vendor/craftcms/cms/src/controllers/DashboardController.php(466): craft\commerce\widgets\AverageOrderTotal->getBodyHtml()
#9 /var/www/html/vendor/craftcms/cms/src/controllers/DashboardController.php(104): craft\controllers\DashboardController->_getWidgetInfo(Object(craft\commerce\widgets\AverageOrderTotal))
#10 [internal function]: craft\controllers\DashboardController->actionIndex()
#11 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#13 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('index', Array)
#14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(340): yii\base\Module->runAction('dashboard/index', Array)
#15 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('dashboard/index', Array)
#16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(308): yii\web\Application->handleRequest(Object(craft\web\Request))
#17 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#18 /var/www/html/public_html/index.php(12): yii\base\Application->run()
#19 {main}

Craft CMS version

Craft Pro 4.9.7

Craft Commerce version

Craft Commerce 4.6.2

PHP version

8.2.18

Operating system and version

Linux 6.6.26-linuxkit

Database type and version

MariaDB 10.2.44

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

-

linear[bot] commented 3 months ago

PT-1803 [4.x]: Calling unknown method: craft\web\twig\variables\CraftVariable::commerce() after upgrading to Craft Commerce 4.6.2

nfourtythree commented 3 months ago

Hi @ax2000

Thank you for your message.

This was an issue with the Verbb Social Login plugin. We submitted a pull request to the plugin to fix the issue.

The PR has been merged so it will be a case of waiting for a release of that plugin which contains the fix.

Hope this helps, thanks!

ax2000 commented 3 months ago

Great - thanks very much for looking into this @nfourtythree .

I'll wait until Verbb release the fix and will confirm then.