What happened?
Description
I have two shipping methods. One for standard shipping, and then free domestic freight shipping option.
On the standard shipping method, I have a global "Match Order" where the the availability of the method is checked via "Total" being less than AUD $500. For the free freight option, it has a "Match Order" of "greater than or equals" AUD $500.
Standard shipping adds an extra $17 to the total, and if the total pre-shipping was already close to $500, then 'standard shipping' method no longer applies when selecting it as an option. That all makes sense, so I went to choose "Item Subtotal" as my condition instead but ended up receiving the following error on save:
TypeError: Cannot assign null to property craft\fields\Money::$currency of type string in /srv/vendor/craftcms/commerce/src/elements/conditions/orders/OrderCurrencyValuesAttributeConditionRule.php:83
Stack trace:
#0 /srv/vendor/craftcms/cms/src/fields/conditions/MoneyFieldConditionRule.php(44): craft\commerce\elements\conditions\orders\OrderCurrencyValuesAttributeConditionRule->field()
#1 /srv/vendor/yiisoft/yii2/base/Component.php(180): craft\fields\conditions\MoneyFieldConditionRule->setAttributes()
#2 /srv/vendor/craftcms/cms/src/helpers/App.php(1546): yii\base\Component->__set()
#3 /srv/vendor/craftcms/cms/src/base/Model.php(81): craft\helpers\App::configure()
#4 /srv/vendor/craftcms/commerce/src/elements/conditions/orders/OrderCurrencyValuesAttributeConditionRule.php(53): craft\base\Model->__construct()
#5 [internal function]: craft\commerce\elements\conditions\orders\OrderCurrencyValuesAttributeConditionRule->__construct()
#6 /srv/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs()
#7 /srv/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#8 /srv/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#9 /srv/vendor/craftcms/cms/src/Craft.php(71): yii\BaseYii::createObject()
#10 /srv/vendor/craftcms/cms/src/services/Conditions.php(123): Craft::createObject()
#11 /srv/vendor/craftcms/cms/src/base/conditions/BaseCondition.php(112): craft\services\Conditions->createConditionRule()
#12 /srv/vendor/craftcms/cms/src/base/conditions/BaseCondition.php(192): craft\base\conditions\BaseCondition->createConditionRule()
#13 /srv/vendor/yiisoft/yii2/base/Component.php(180): craft\base\conditions\BaseCondition->setConditionRules()
#14 /srv/vendor/craftcms/cms/src/helpers/App.php(1546): yii\base\Component->__set()
#15 /srv/vendor/craftcms/cms/src/base/Model.php(81): craft\helpers\App::configure()
#16 /srv/vendor/craftcms/cms/src/elements/conditions/ElementCondition.php(86): craft\base\Model->__construct()
#17 [internal function]: craft\elements\conditions\ElementCondition->__construct()
#18 /srv/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs()
#19 /srv/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#20 /srv/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#21 /srv/vendor/craftcms/cms/src/Craft.php(71): yii\BaseYii::createObject()
#22 /srv/vendor/craftcms/cms/src/services/Conditions.php(66): Craft::createObject()
#23 /srv/vendor/craftcms/commerce/src/base/ShippingMethod.php(163): craft\services\Conditions->createCondition()
#24 /srv/vendor/craftcms/commerce/src/controllers/ShippingMethodsController.php(104): craft\commerce\base\ShippingMethod->setOrderCondition()
#25 [internal function]: craft\commerce\controllers\ShippingMethodsController->actionSave()
#26 /srv/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#27 /srv/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#28 /srv/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#29 /srv/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction()
#30 /srv/vendor/craftcms/cms/src/web/Application.php(660): craft\web\Application->runAction()
#31 /srv/vendor/craftcms/cms/src/web/Application.php(323): craft\web\Application->_processActionRequest()
#32 /srv/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#33 /srv/web/index.php(21): yii\base\Application->run()
#34 {main}
Out of interest, I manually tried hard-coding 'AUD' as the currency value in OrderCurrencyValuesAttributeConditionRule field(), and the frontend worked as expected.
Steps to reproduce
Hopefully reproducing is as simple as:
- Make your primary currency AUD. Ours looks like this:

- Add a shipping method and attempt to use "Item Subtotal" in a condition. E.g.

- Attempt to save the shipping method and (hopefully) observe the same error as above.
Expected behavior
I would be able to save the shipping method using "Item Subtotal" without error.
Actual behavior
I cannot save the shipping method when using "Item Subtotal".
Craft CMS version
5.6.5.1
Craft Commerce version
5.3.2.2
PHP version
8.2.16
Operating system and version
Linux 6.8.0-49-generic
Database type and version
MariaDB 10.6.14
Image driver and version
No response
Installed plugins and versions
What happened?
Description
I have two shipping methods. One for standard shipping, and then free domestic freight shipping option.
On the standard shipping method, I have a global "Match Order" where the the availability of the method is checked via "Total" being less than AUD $500. For the free freight option, it has a "Match Order" of "greater than or equals" AUD $500.
Standard shipping adds an extra $17 to the total, and if the total pre-shipping was already close to $500, then 'standard shipping' method no longer applies when selecting it as an option. That all makes sense, so I went to choose "Item Subtotal" as my condition instead but ended up receiving the following error on save:
Out of interest, I manually tried hard-coding 'AUD' as the currency value in OrderCurrencyValuesAttributeConditionRule field(), and the frontend worked as expected.
Steps to reproduce
Hopefully reproducing is as simple as:
Expected behavior
I would be able to save the shipping method using "Item Subtotal" without error.
Actual behavior
I cannot save the shipping method when using "Item Subtotal".
Craft CMS version
5.6.5.1
Craft Commerce version
5.3.2.2
PHP version
8.2.16
Operating system and version
Linux 6.8.0-49-generic
Database type and version
MariaDB 10.6.14
Image driver and version
No response
Installed plugins and versions