ACSD-63062: Incorrect cart discount calculations occur when multiple overlapping rules are applied
Incorrect cart discount calculations occur when multiple overlapping rules are applied. Quality patch ACSD-63062 for magento/module-quote applies to Magento Open Source and Adobe Commerce 2.4.7 to 2.4.7-p10.
- Categories
- Shopping Cart
- Components
- magento/module-quote, magento/module-sales-rule
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.56
Issue
Incorrect cart discount calculations occur when multiple overlapping rules are applied.
Steps to reproduce
1. Install fresh instance with sample data. 1. Create three simple products: * simple1: $1080 * simple2: $260 * simple3: $280 1. Create four Cart Price Rules as follows: * Rule 1: * Priority: 100 * Conditions tab: Use simple2 ($280) product if total qty equals or is greater than 3 * Actions tab: SKU is simple2 * Fixed Amount Discount: $80 * Rule 2: * Priority: 200 * Actions tab: SKU is simple2 * Percentage of Product Price Discount: 20% * Rule 3: * Priority: 300 * Conditions tab: Subtotal equals or is greater than $1000 * Fixed Amount Discount for the whole cart: $100 * Rule 4: * Priority: 400 * Conditions tab: Use simple1 ($1080) product if total qty equals or is greater than 2 * Actions tab: SKU is simple1 * Fixed Amount Discount for the whole cart: $960 1. Go to the storefront and add the following products with given quantity to the cart: * simple1 = 2 * simple2 = 1 * simple3 = 3 1. Check the shopping cart.
Adobe's page lists 2.4.7 - 2.4.7-p3 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.8.
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 ACSD-63062. On Cloud, add ACSD-63062 under stage.build.QUALITY_PATCHES in .magento.env.yaml.
For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACSD-63062/ 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-base >=2.4.7 <2.4.8
- Magento Open Source
- 2.4.7-p10, 2.4.7-p9, 2.4.7-p8, 2.4.7-p7, 2.4.7-p6, 2.4.7-p5, 2.4.7-p4, 2.4.7-p3, 2.4.7-p2, 2.4.7-p1, 2.4.7
- Adobe Commerce
- 2.4.7-p10, 2.4.7-p9, 2.4.7-p8, 2.4.7-p7, 2.4.7-p6, 2.4.7-p5, 2.4.7-p4, 2.4.7-p3, 2.4.7-p2, 2.4.7-p1, 2.4.7
- Patch file
- patches/os/ACSD-63062_2.4.7-p2.patch
- vendor/magento/module-sales-rule/Helper/CartFixedDiscount.php
- vendor/magento/module-quote/Model/Quote/Item/AbstractItem.php
- vendor/magento/module-sales-rule/Model/Quote/Discount.php
- vendor/magento/module-sales-rule/Model/Rule/Action/Discount/CartFixed.php
