Coupon for single use can be used multiple times #38017
Description
Preconditions and environment
- Magento version 2.4.6-p2
- Anything else that would help a developer reproduce the bug
Steps to reproduce
-
Create a cart rule with coupon usage and usage per coupon = 1
-
Open browser 1, apply coupon code an go to last checkout page
-
Open browser 2 (or incognito tab), apply coupon code an go to last checkout page
-
Place order in browser 1 and 2 simultanously (a few seconds might be ok)
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”.