Commerce element query on custom field in console command I'm on Craft 3.4.30 (latest 3.4) and Commerce 2.2.25 (latest 2.2):
My product type &quot;ticket&quot; has a custom date field with handle productStartDate.
E.g. the following query in TWIG works:
{% set products = craft.products().type('ticket').productStartDate('&gt;= 2021-01-01 00:00:00').all() %}

I get nice results including my custom field productStartDate
I am trying the same in a console command with PHP:
use craft\commerce\elements\Product;
$product = Product::find()
                -&gt;type('ticket')
                -&gt;productStartDate('&gt;= 2021-01-01 00:00:00')
                -&gt;all();

Gives me this Exception:
Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: craft\behaviors\CustomFieldBehavior::productStartDate()'

in /myproject/vendor/yiisoft/yii2/base/BaseObject.php:222

Stack trace:
#0 /myproject/storage/runtime/compiled_classes/CustomFieldBehavior.php(542): yii\base\BaseObject-&gt;__call('productStartDat...', Array)
#1 [internal function]: craft\behaviors\CustomFieldBehavior-&gt;__call('productStartDat...', Array)
#2 /myproject/vendor/yiisoft/yii2/base/Component.php(297): call_user_func_array(Array, Array)
#3 /myproject/vendor/craftcms/cms/src/elements/db/ElementQuery.php(548): yii\base\Component-&gt;__call('productStartDat...', Array)
#4 /myproject/modules/console/controllers/WarmProductGroupsController.php(61): craft\elements\db\ElementQuery-&gt;__call('productStartDat...', Array)
#5 [internal function]: modules\console\controllers\WarmProductGroupsController-&gt;actionIndex(false)
#6 /myproject/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /myproject/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&gt;runWithParams(Array)
#8 /myproject/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller-&gt;runAction('', Array)
#9 /myproject/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller-&gt;runAction('', Array)
#10 /myproject/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module-&gt;runAction('theme/warm-prod...', Array)
#11 /myproject/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application-&gt;runAction('theme/warm-prod...', Array)
#12 /myproject/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application-&gt;runAction('theme/warm-prod...', Array)
#13 /myproject/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application-&gt;handleRequest(Object(craft\console\Request))
#14 /myproject/craft(22): yii\base\Application-&gt;run()
#15 {main}

Any hints why?
Found it: the reason for the Exception is, that the dynamic method productStartDate (coming from the CustomFieldBehavior) needs an Array as parameter.
I have no clue why I get this misleading Exception though...
So finally, this works:
use craft\commerce\elements\Product;
$product = Product::find()
                -&gt;type('ticket')
                -&gt;productStartDate(['&gt;=&quot;2021-01-01 00:00:00&quot;'])
                -&gt;all();