MDVA-34591: Cart price rule calculations not as expected

The MDVA-34591 patch fixes the issue where the 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 Quality Patches Tool (QPT) 1.0.19 is installed. The patch ID is MDVA-34591. Please note that the issue is scheduled to be fixed in Adobe Commerce version 2.4.3.

Affected products and versions

The patch is created for Adobe Commerce version:

Adobe Commerce on cloud infrastructure 2.3.6

Compatible with Adobe Commerce versions:

Adobe Commerce on-premises and Adobe Commerce on cloud infrastructure 2.3.0-2.4.2

NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.

Issue

Steps to reproduce:

  1. Go to the Admin, and create the following two rules:

    • Rule 1: $10 off a maximum of three items in the cart. Set priority = 3.
    • Rule 2: 50% off all products in the cart. Set priority = 1.
  2. Go to the storefront.

  3. Add eight quantities of a product set to price = $51 each to the cart.

  4. 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 deployment method:

To learn more about Quality Patches Tool, refer to:

For info about other patches available in QPT, refer to the Patches available in QPT section.

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