Skip to content

Coupon for single use can be used multiple times #38017

Open
@HenKun

Description

Preconditions and environment

  • Magento version 2.4.6-p2
  • Anything else that would help a developer reproduce the bug

Steps to reproduce

  1. Create a cart rule with coupon usage and usage per coupon = 1
    1

  2. Add fixed cart as Action
    2

  3. Generate coupon code (used is no, used times is 0)
    3

  4. Open browser 1, apply coupon code an go to last checkout page
    4

  5. Open browser 2 (or incognito tab), apply coupon code an go to last checkout page
    5

  6. Place order in browser 1 and 2 simultanously (a few seconds might be ok)

  7. Both orders are successfull
    6
    7
    8

  8. Control coupn code usage. It is used and "times used" is 2
    9

Expected result

Coupon can only be used for one order

Actual result

Coupon can be used multiple times, if fast enough

Additional information

Related:

https://experienceleague.adobe.com/docs/commerce-knowledge-base/kb/troubleshooting/miscellaneous/coupon-code-used-more-than-once-adobe-commerce.html?lang=en
#23907
#35077

In this case, the consumer is correctly set up, so the coupon code usage is raised correctly. However, due to the queue mechanism, this is not done fast enough, so a customer can place multiple orders with the same coupon code within the time period the system needs to raise the coupon usage.

This can be exploited by customers, e.g. if coupon codes are used as simple gift cards.

Maybe it isn't a good idea to use queues in this scenario where it relies on an immediate raise of the coupon code usage?
Or a coupon code should already be blocked when it is applied to the quote.

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

No one assigned

    Labels

    Area: OrderIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: dev in progressReported on 2.4.6-p2Indicates 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

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions