Skip to content

Commit c3cf101

Browse files
committed
ACP2E-2269: Cart rules without coupon code not working
1 parent ceb20ce commit c3cf101

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/code/Magento/Rule/Model/Condition/AbstractCondition.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,16 +885,15 @@ public function validateAttribute($validatedValue)
885885
*/
886886
protected function _compareValues($validatedValue, $value, $strict = true)
887887
{
888-
if (null === $value || null === $validatedValue ||
889-
$strict && is_numeric($validatedValue) && is_numeric($value)) {
888+
if ($strict && is_numeric($validatedValue) && is_numeric($value)) {
890889
return $validatedValue == $value;
891890
}
892891

893892
$validatePattern = preg_quote((string) $validatedValue, '~');
894893
if ($strict) {
895894
$validatePattern = '^' . $validatePattern . '$';
896895
}
897-
return (bool)preg_match('~' . $validatePattern . '~iu', $value);
896+
return (bool)preg_match('~' . $validatePattern . '~iu', (string)$value);
898897
}
899898

900899
/**

app/code/Magento/Rule/Test/Unit/Model/Condition/AbstractConditionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public function validateAttributeDataProvider()
6262
['1', '==', 1, true],
6363
['x', '==', 'x', true],
6464
['x', '==', 0, false],
65+
[null, '==', 0, false],
66+
[null, '==', 0.00, false],
6567

6668
[1, '!=', 1, false],
6769
[0, '!=', 1, true],

0 commit comments

Comments
 (0)