Coupon for single use is used multiple times, Adobe Commerce

This article provides a solution for the issue when cart price rule coupons are not working properly. Merchants set up a coupon for single use and customers are able to use it multiple times.

Affected products and versions

Adobe Commerce (all deployment methods) 2.4.3 and above

Issue

Merchants set up a coupon for single use and customers are able to use it multiple times.

Steps to reproduce:

  1. Create a coupon and configure the coupon to single use.
  2. Proceed to checkout.
  3. Use the coupon that you just created.
  4. Proceed to checkout again and use the same coupon.

Expected result:

The coupon can only be used once. A message displays: The coupon code “COUPON_NAME” is not valid.

Actual result:

The coupon can be used more than once.

Cause

Merchants do not have sales.rule.update.coupon.usage consumer set up and running that results in improper behavior.

Solution

Add the sales.rule.update.coupon.usage consumer to the app/etc/env.php file.

...
    'cron_consumers_runner' =>
    array [
        'cron_run' => true,
        'max_messages' => 20000,
        'consumers' =>
        array [
            'sales.rule.update.coupon.usage'
        ]
    ],
...

For detailed steps, refer to Manage message queues > Configuration in our developer documentation.

Message Queues Overview in our developer documentation.

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a