The MDVA-34591 Magento patch fixes the issue where cart price rule with Maximum Qty Discount is Applied To does not work correctly if multiple cart price rules are applied.
This patch is available when the Magento Quality Patch (MQP) tool 1.0.19 is installed. The patch ID is MDVA-34591. Please note that the issue is scheduled to be fixed in Magento version 2.4.3.
Affected products and versions
The patch is created for Magento version:
Magento Commerce Cloud 2.3.6
Compatible with Magento versions:
Magento Commerce and Magneto Commerce Cloud 2.3.0-2.4.2
Note: the patch can be applicable to other versions. To check if the patch is compatible with your Magento version, run ./vendor/bin/magento-patches status
.
Issue
Steps to reproduce:
- Go to the Admin, and create the following two rules:
- Rule 1: $10 off a maximum of 3 items in the cart. Set priority = 3.
- Rule 2: 50% off all products in the cart. Set priority = 1.
- Go to the storefront.
- Add 8 quantities of a product set to price = $51 each to the cart.
- Check the discount amount in the cart.
Expected results:
The correct calculated discount is $234, as expected.
- Calculations:
Matching cart price rules: Rule 2, Rule 1
Apply Rule 2 (50% off), so Discount = $204
Apply Rule 1 (10 off 3 items), so Discount = $30
Total Discount = MIN ( 408/2 + 10x3, 8 * 51) = MIN (204 + 30, 8 * 51) = $234
Actual results:
The discount is incorrectly calculated to be $153, caused by the wrong quantity used for calculating maximum discount value, as the fixed discount amount is applied regardless of the products' amount in the shopping cart.
- Calculations:
Matching cart price rules: Rule 2, Rule 1
Apply Rule 2 (50% off), so Discount = $204
Apply Rule 1 (10 off 3 items), so Discount = $30
Total Discount = MIN (204 + 30, 3 * 51) = $153
Apply the patch
To apply individual patches use the following links depending on your Magento product:
- Magento Commerce: DevDocs Software Update Guide > Apply Patches.
- Magento Commerce Cloud: DevDocs Upgrades and Patches > Apply Patches.
Related reading
To learn more about Magento Quality Patches, refer to:
- Magento Quality Patches released: a new tool to self-serve quality patches.
- Check patch for Magento issue with Magento Quality Patches.
For info about other patches available in MQP tool, refer to the Patches available in MQP tool section.