We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Due to the rule being applied in two places:
LineItem::defineRules https://github.com/craftcms/commerce/blob/3.4.23/src/models/LineItem.php#L465 https://github.com/craftcms/commerce/blob/4.3.2/src/models/LineItem.php#L420
LineItem::defineRules
Variant::getLineItemRules() https://github.com/craftcms/commerce/blob/3.4.23/src/elements/Variant.php#L820 https://github.com/craftcms/commerce/blob/4.3.2/src/elements/Variant.php#L826
Variant::getLineItemRules()
at validation time, the error is added twice.
I haven't tested the 4.x branch, but the code appears to be the same.
$lineItem = new \craft\commerce\models\LineItem([ 'purchasableId' => Craft::$app->getElements()->createElementQuery(\craft\commerce\elements\Variant::class)->scalar(), 'qty' => 0, ]); $lineItem->validate(); var_dump($lineItem->getErrors('qty'));
array(1) { [0] => string(27) "Qty must be no less than 1." }
array(2) { [0] => string(27) "Qty must be no less than 1." [1] => string(27) "Qty must be no less than 1." }
"craftcms/cms": "3.9.5"
"craftcms/commerce": "3.4.23"
No response
The text was updated successfully, but these errors were encountered:
997cc85
Thanks for reporting that! I’ve just fixed it for the next release.
To get the fix early, change your craftcms/commerce requirement in composer.json to:
craftcms/commerce
"require": { "craftcms/commerce": "dev-develop#ad6803123e4dbe5127fb7780a9ed650dda27ac29", "...": "..." }
Then run composer update.
composer update
We will update you here once the release is out. Thanks.
Sorry, something went wrong.
No branches or pull requests
What happened?
Description
Due to the rule being applied in two places:
LineItem::defineRules
https://github.com/craftcms/commerce/blob/3.4.23/src/models/LineItem.php#L465
https://github.com/craftcms/commerce/blob/4.3.2/src/models/LineItem.php#L420
Variant::getLineItemRules()
https://github.com/craftcms/commerce/blob/3.4.23/src/elements/Variant.php#L820
https://github.com/craftcms/commerce/blob/4.3.2/src/elements/Variant.php#L826
at validation time, the error is added twice.
I haven't tested the 4.x branch, but the code appears to be the same.
Steps to reproduce
Expected behavior
Actual behavior
Craft CMS version
"craftcms/cms": "3.9.5"
Craft Commerce version
"craftcms/commerce": "3.4.23"
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
The text was updated successfully, but these errors were encountered: