-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
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
Cart price rule with condition SKU dosen't take into account the "leading zeros" in the SKU (sku: 01234 is the same as 1234) #37919
Comments
Hi @matejslo. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Dash. Thank you for working on this issue.
|
@magento give me 2.4-develop instance |
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you. |
Hi @engcom-Dash, here is your Magento Instance: https://df1b5a8304be8d8cf43f690f97049903.instances-prod.magento-community.engineering |
@magento give me 2.4-develop instance |
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you. |
Hi @engcom-Dash, here is your Magento Instance: https://df1b5a8304be8d8cf43f690f97049903.instances-prod.magento-community.engineering |
Hi @matejslo , verified the issue in 2.4-develop instance and issue can be reproducible,Hence we are confirming the issue,Kindly refer the below screenshots: Thanks. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-9428 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Dash. Thank you for verifying the issue. |
@magento I am working on it |
I have tested using the following patch and this has worked as expected for me. index d5d3b80..2727e39 100644
--- a/Model/Condition/AbstractCondition.php
+++ b/Model/Condition/AbstractCondition.php
@@ -887,7 +887,7 @@ abstract class AbstractCondition extends \Magento\Framework\DataObject implement
{
if (null === $value || null === $validatedValue ||
$strict && is_numeric($validatedValue) && is_numeric($value)) {
- return $validatedValue == $value;
+ return $validatedValue === $value;
}
$validatePattern = preg_quote((string) $validatedValue, '~'); I am on version 2.4.3-p1. It looks like it is working as expected on version 2.4.6-p1, however, this is not the fix that was done. I could not find the exact fix done by Adobe. |
Preconditions and environment
Magento ver. 2.4.4
Steps to reproduce
Expected result
Discount for product with SKU: 1234 of 50% should NOT be applied.
Actual result
Discount for product with SKU: 1234 IS applied (even the SKU is not in the CART PRICE RULE CONDITION).
Additional information
It seems that Magento 2 doesn't recognize the leading zeros of SKU.
From our diagnosis it seems that the problem is here:
\Magento\Rule\Model\Condition\AbstractCondition::_compareValues
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: