Skip to content

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

Open
@matejslo

Description

Preconditions and environment

Magento ver. 2.4.4

Steps to reproduce

  1. Create product with SKU: 1234
  2. Create product with SKU: 01234
  3. Create CART PRICE RULE (for example):
  • Specific coupon
  • Coupon code: TESTSKU
  • ACTION: percent of product price discount, 50% discount amount)
  • Apply the rule only to cart items ... (SKU is 01234)
  1. Go to shop front and add product SKU 1234 to CART
  2. On the cart page enter the coupon code TESTSKU

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

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Assignees

Labels

Area: Admin UIIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: PR in progressReported on 2.4.4Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

  • Status

    Ready for Development

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions