ACP2E-4522: An intermittent duplicate key error occurs on the quote_coupons table…
An intermittent duplicate key error occurs on the quote_coupons table when multiple cart merge or quote save requests run at the same time. Quality patch ACP2E-4522 for magento/module-multicoupon applies to Magento Open Source and Adobe Commerce 2.4.7 to 2.4.8-p5.
- Categories
- Shopping Cart
- Components
- magento/module-multicoupon
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.78
Issue
An intermittent duplicate key error occurs on the quote_coupons table when multiple cart merge or quote save requests run at the same time.
Steps to reproduce
1. Enable the maximum number of coupons per order = 10 under the Admin sidebar at Stores > Settings > Configuration > Sales > Multicoupon Settings. 1. Create a Cart Price Rule under Marketing > Promotions > Cart Price Rules > Add New Rule: 1. Rule Name: TESTCOUPON2026 1. Active: Yes; Websites: Main Website; Customer Groups; Select all applicable groups. 1. Coupon: Specific Coupon; Coupon Code: TESTCOUPON2026. 1. Uses per Customer: leave blank. 1. Conditions: No conditions added. 1. Actions > Percent of product price discount; Discount Amount = 10. 1. Add a product with a quantity of at least 7 to a guest cart using GraphQL, and then apply the coupon. 1. Run six concurrent parallel GraphQL mergeCarts calls: mutation { mergeCarts( source_cart_id: "<GUEST_CART_ID>" destination_cart_id: "<DESTINATION_CART_ID>" ) { id items { id product { sku } } applied_coupons { code } } }
Adobe's page lists 2.4.7 - 2.4.8-p4 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.
Adobe scheduled the permanent fix for 2.4.9.
Install
Install the Quality Patches Tool with composer require magento/quality-patches, apply the prerequisites listed for all files applicable to your distribution and version first, then run vendor/bin/magento-patches apply ACP2E-4522. On Cloud, add ACP2E-4522 under stage.build.QUALITY_PATCHES in .magento.env.yaml.
For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACP2E-4522/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Bundle prerequisites the same way and list them first. Paths are relative to each package root, using the default -p1 level. Prefer local files when configuring composer-patches; a remote URL can change.
Patch files and compatible versions
magento/magento2-ee-base >=2.4.7 <2.4.9
- Magento Open Source
- —
- vendor/magento/module-multicoupon/Model/ResourceModel/Quote/AddCoupons.php
