51ºÚÁϲ»´òìÈ

Coupon code tracking discrepancy in 51ºÚÁϲ»´òìÈ Commerce

If a coupon is configured to be usable X times per customer, the coupon codes could be applied more than X times without having their usage count updated after placing the order. To fix this, enable the consumer by adding sales.rule.update.coupon.usage to the CRON_CONSUMERS_RUNNER variable in .magento.env.yaml, edit the file to locate the CRON_CONSUMERS_RUNNER section, set consumers to an empty array for future-proofing, and redeploy your environment.

Description description

Environment

51ºÚÁϲ»´òìÈ Commerce (AC) all deployment methods, all versions

Issue/Symptoms

  • Coupon codes can be reused for different orders without updating the usage count.
  • The Used Ìý²¹²Ô»å TimeUsed  columns in the cart price rule’s manage coupon section don’t reflect changes after a coupon is applied.
  • This issue persists across different environments, including local setups with vanilla (standard) Magento instances.

Resolution resolution

To resolve this issue, ensure that the sales.rule.update.coupon.usage consumer is enabled:

  1. Add sales.rule.update.coupon.usage to the CRON_CONSUMERS_RUNNER variable in .magento.env.yaml.

  2. Edit your .magento.env.yaml file, locate the CRON_CONSUMERS_RUNNER section under the deployment stage configuration, and ensure it includes:

    code language-none
    stage:
        deploy:
            CRON_CONSUMERS_RUNNER:
                cron_run: true
                max_messages: 1000
                consumers:
                    - sales.rule.update.coupon.usage
    
  3. For future-proofing against updates, consider setting consumers to an empty array to enable all available consumers automatically:

    code language-none
    stage:
        deploy:
            CRON_CONSUMERS_RUNNER:
                cron_run: true
                max_messages: 1000
                consumers: [ ]
    
  4. After making these changes, redeploy your environment to apply them.

Note: This solution will update coupon usage for future transactions but won’t retroactively adjust past orders’ data regarding coupon usage.

CRON_CONSUMERS_RUNNER in Deploy Variables in Commerce on Cloud Guide

ACSD-49737: Coupon is incorrectly marked as used after a failed card payment | 51ºÚÁϲ»´òìÈ Commerce

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f