ACSD-56158: Wrong tax value in GraphQL response when multiple tax rules applied to cart

The ACSD-56158 patch fixes the issue where the tax value rendering in the GraphQL response is incorrect when multiple tax rules are applied to the cart. This patch is available when the Quality Patches Tool (QPT) 1.1.44 is installed. The patch ID is ACSD-56158. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.7.

Affected products and versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.5-p5

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.5-p5 - 2.4.6-p3
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 tax value rendering in the GraphQL response is incorrect when multiple tax rules are applied to the cart.

Steps to reproduce:

  1. Create a customer with a US address.

  2. Navigate to the Admin Panel.

  3. Create a product with a price of $100.

  4. Create two tax rates for the US address: one for 10% and the other for 5%.

  5. Configure two tax rules for USA from Stores > Taxes > Tax Rule.

  6. Assign one tax rate to one rule.

  7. From the frontend, log in as the customer with the US address, and add the product to the cart.

  8. Generate a customer token via GraphQL.

  9. Generate a cart ID via GraphQL.

  10. Check that the tax applied is correct by getting the customer’s cart via GraphQL:

    code language-graphql
    {
        cart(cart_id: "o3Yqt6zkn8ncOzFxGnR1IWdT..") {
            id
            email
            billing_address {
                city
                country {
                    code
                    label
                }
                firstname
                lastname
                company
                postcode
                vat_id
                region {
                    code
                    label
                }
                street
                telephone
            }
            shipping_addresses {
                firstname
                lastname
                company
                street
                city
                postcode
                vat_id
                region {
                    code
                    label
                }
                country {
                    code
                    label
                }
                telephone
                available_shipping_methods {
                    amount {
                        currency
                        value
                    }
                    available
                    carrier_code
                    carrier_title
                    error_message
                    method_code
                    method_title
                    price_excl_tax {
                        value
                        currency
                    }
                    price_incl_tax {
                        value
                        currency
                    }
                }
                selected_shipping_method {
                    amount {
                        value
                        currency
                    }
                    carrier_code
                    carrier_title
                    method_code
                    method_title
                }
            }
            available_payment_methods {
                code
                title
            }
            selected_payment_method {
                code
                title
            }
            applied_coupons {
                code
            }
            prices {
                grand_total {
                    value
                    currency
                }
                subtotal_excluding_tax {
                    value
                    currency
                }
                subtotal_including_tax {
                    value
                    currency
                }
                applied_taxes {
                    label
                    amount {
                        currency
                        value
                    }
                }
            }
        }
    }
    

Expected results:

Each tax rate shows its own tax amount:

"applied_taxes": [
    {
        "label": "US-CA-*-Rate 1",
        "amount": {
            "currency": "USD",
            "value": 10
        }
    },
    {
        "label": "US-CA-*-Rate 2",
        "amount": {
            "currency": "USD",
            "value": 5
        }
    }
]

Actual results:

Total tax amount returned for each rule:

"applied_taxes": [
    {
        "label": "US-CA-*-Rate 1",
        "amount": {
            "currency": "USD",
            "value": 15
        }
    },
    {
        "label": "US-CA-*-Rate 2",
        "amount": {
            "currency": "USD",
            "value": 15
        }
    }
]

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 Quality Patches Tool: Search for patches in the Quality Patches Tool guide.

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