[PaaS only]{class="badge informative" title="Applies to Adobe Commerce on Cloud projects (Adobe-managed PaaS infrastructure) and on-premises projects only."}

ACSD-66963: estimateTotals mutation returns null for discounts on virtual products

The ACSD-66963 patch fixes the issue where estimateTotals returns null for discounts when a discount code is applied to a cart with only virtual products. This patch is available when the Quality Patches Tool (QPT) 1.1.68 is installed. The patch ID is ACSD-66963. Please note that this issue was fixed in Adobe Commerce 2.4.8.

Affected products and versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.7-p4

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.7 - 2.4.7-p6
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

The estimateTotals mutation returns null for discounts when a discount code is applied to a cart containing only virtual products.

Steps to reproduce:

  1. Create a cart containing only virtual products.

  2. Apply a discount code:

    code language-none
    mutation {
      estimateTotals(
        input: {
          cart_id: "cart_id",
          address: {
            country_code: US,
            postcode: "78732",
            region: {
              region_code: "TX"
            }
          },
          shipping_method: {
            carrier_code: "{$shipping}",
            method_code: "{$shipping}"
          }
        }
      ) {
        cart {
          prices {
            discounts {
              amount {
                value
                currency
              }
              label
              coupon {
                code
              }
              applied_to
              type
            }
          }
        }
      }
    }
    

Expected results:

Discount information is included for carts containing only virtual products.

    {
      "data": {
        "estimateTotals": {
          "cart": {
            "prices": {
              "discounts": [
                {
                  "amount": {
                    "value": 100.5,
                    "currency": "USD"
                  },
                  "label": "A second discount code for testing",
                  "coupon": {
                    "code": "z3r0c00l"
                  },
                  "applied_to": "ITEM",
                  "type": null
                }
              ]
            }
          }
        }
      },
      "extensions": {}
    }

Actual results:

Discount information returns as null for carts with only virtual products.

    {
      "data": {
        "estimateTotals": {
          "cart": {
            "prices": {
              "discounts": null
            }
          }
        }
      },
      "extensions": {}
    }

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:

recommendation-more-help
c2d96e17-5179-455c-ad3a-e1697bb4e8c3