QUALITY PATCH

ACSD-68356: GraphQL cart queries return incorrect discount amounts for virtual quotes…

GraphQL cart queries return incorrect discount amounts for virtual quotes, applying discounts to ineligible virtual products. Quality patch ACSD-68356 for magento/module-quote-graph-ql applies to Magento Open Source and Adobe Commerce 2.4.8 to 2.4.8-p5.

Categories
GraphQL, Price/Tax
Components
magento/module-quote-graph-ql
Origin
adobe-commerce-support
Since QPT
1.1.73

Issue

GraphQL cart queries return incorrect discount amounts for virtual quotes, applying discounts to ineligible virtual products.

Steps to reproduce

1. Create two virtual products: 1. virtual1 SKU 1. virtual2 SKU 1. Create a cart price rule: 1. Set to apply automatically, without a coupon. 1. Actions: 1. Percent of product price discount - 20%. 1. Applies only to cart items where SKU is virtual2. 1. Add products to a fresh empty quote through storefront: 1. Add virtual1 SKU first. 1. Add virtual2 SKU second. 1. Get cart details using the following GraphQL query: { cart(cart_id: "cart_id") { email itemsV2 { total_count items { uid prices { total_item_discount { value } price { value } discounts { label amount { value } } } product { name sku } quantity }, page_info { page_size current_page total_pages } } applied_coupons { code } prices { discounts { amount { value } applied_to label } grand_total { value } } } } 1. Check cart > items > prices > discounts.

Adobe's page lists 2.4.8 - 2.4.8-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.9.

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-68356. On Cloud, add ACSD-68356 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-68356/ 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

Packages across compatible versions (1): magento/module-quote-graph-ql
Packages across compatible versions (1): magento/module-quote-graph-ql

magento/magento2-base >=2.4.8 <2.4.9

Magento Open Source
2.4.8-p5, 2.4.8-p4, 2.4.8-p3, 2.4.8-p2, 2.4.8-p1, 2.4.8
Adobe Commerce
2.4.8-p5, 2.4.8-p4, 2.4.8-p3, 2.4.8-p2, 2.4.8-p1, 2.4.8
Patch file
patches/os/ACSD-68356_2.4.8-p2.patch
  • vendor/magento/module-quote-graph-ql/Model/GetDiscounts.php
  • vendor/magento/module-quote-graph-ql/Model/Resolver/Discounts.php

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.