commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[5.x]: Unable to find component class `craft\elements\actions\Copy` after update to Commerce`5.4.0`

Open wanze opened this issue 8 months ago • 1 comments

What happened?

Description

After updating my local installation to Commerce 5.4.0, it is not possible to load the variants when opening a product. The table listing the variants is empty and he following error is thrown:

2025-06-24 08:31:26 [web.ERROR] [craft\errors\MissingComponentException] craft\errors\MissingComponentException: Unable to find component class 'craft\elements\actions\Copy'. in /var/www/html/vendor/craftcms/cms/src/helpers/Component.php:48

Stack trace:

#0 /var/www/html/vendor/craftcms/cms/src/helpers/Component.php(133): craft\helpers\Component::validateComponentClass()

#1 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(2833): craft\helpers\Component::createComponent()

#2 /var/www/html/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(894): craft\services\Elements->createAction()

#3 /var/www/html/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(128): craft\controllers\ElementIndexesController->availableActions()

#4 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(176): craft\controllers\ElementIndexesController->beforeAction()

#5 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()

#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction()

#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(660): craft\web\Application->runAction()

#8 /var/www/html/vendor/craftcms/cms/src/web/Application.php(323): craft\web\Application->_processActionRequest()

#9 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()

#10 /var/www/html/web/index.php(12): yii\base\Application->run()

#11 {main} {"memory":5944736,"exception":"[object] (craft\\errors\\MissingComponentException(code: 0): Unable to find component class 'craft\\elements\\actions\\Copy'. at /var/www/html/vendor/craftcms/cms/src/helpers/Component.php:48)"} 

I am running Craft 5.6.17. Could this error be related to the new Copy feature introduced in Craft 5.7? If so, Commerce 5.4 should probably require Craft 5.7.

Steps to reproduce

  1. Open any product
  2. Variants do not load and the error is shown

Expected behavior

Variants are displayed.

Craft CMS version

5.6.17

Craft Commerce version

5.4.0

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

wanze avatar Jun 24 '25 06:06 wanze

Thanks for reporting this. Using 5.6 should be fine, we just needed to guard the copy feature correctly. I have fixed this error.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "5.x-dev#e4c24025b570d4f6ef5d6cf86fce9973e3057971 as 5.4.0",
  "...": "..."
}

Then run composer update.

We will update this ticket once the release is out.

lukeholder avatar Jun 25 '25 14:06 lukeholder

Commerce 5.4.1 has now been released with this fix included.

Thanks!

nfourtythree avatar Jul 09 '25 14:07 nfourtythree