ACSD-66120: GraphQL incorrectly displays discount percentages and base prices…
GraphQL incorrectly displays discount percentages and base prices when catalog prices are configured to include tax. Quality patch ACSD-66120 for magento/module-catalog-graph-ql applies to Magento Open Source and Adobe Commerce 2.4.4 to 2.4.8-p5.
- Categories
- GraphQL, Price/Tax
- Components
- magento/module-catalog-graph-ql, magento/module-catalog-rule, magento/module-tax
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.70
Issue
GraphQL incorrectly displays discount percentages and base prices when catalog prices are configured to include tax. Due to rounding errors, the discount percentage shows as 19.99% instead of the configured 20%.
Steps to reproduce
1. Go to Stores > Settings > Configuration > Catalog > Catalog > Price. 1. Set Catalog Price Scope to Website. 1. Go to Stores > Settings > Configuration > Sales > Tax > Calculation Settings. 1. Set Tax Calculation Method Based On to Unit Price. 1. Set Catalog Prices to Including Tax. 1. Set Apply Discount On Prices to Including Tax. 1. Go to Stores > Settings > Configuration > Sales > Tax > Default Tax Destination Calculation. 1. Set Default Country to France. 1. Go to Stores > Tax Zones and Rates > Add new Tax Rate. 1. Enter any name in the Tax Identifier field. 1. Enter an asterisk (*) in the Zip/Post Code field. 1. Set Country to France. 1. Enter 20.000000 in the Rate Percent field. 1. Click Save. 1. Go to Stores > Tax Rules > Add New Tax Rule. 1. Enter any name in the Name field. 1. Set Tax Rate to rate added in previous step. 1. Go to Catalog > Products > Add Product. 1. Enter test in the Product Name field. 1. Enter test in the SKU field. 1. Enter 82.65 in the Price field. 1. Set Tax Class to Taxable Goods. 1. Enter 100 in the Quantity field. 1. Click Save. 1. Change scope to Default Store View. 1. Unset Use Default Value on Price. 1. Set Price to 68.87. 1. Unset Use Default Value on Tax Class. 1. Set Tax Class to Taxable goods. 1. Click Save. 1. Go to Marketing > Promotions > Catalog Price Rule > Add New Rule. 1. Enter any name in the Rule Name field. 1. Set Active to Yes. 1. Set Website to Main Website. 1. Set Customer Groups to all 1. Under Actions, set Apply to Apply as percentage of original. 1. Enter 20.000000 in the Discount Amount field. 1. Click Save. 1. Perform a full reindex: $ bin/magento index:reindex 1. Perform the following GraphQL query with Store: default set in the headers: query{ products(filter: {sku: {eq: "test"}}, sort: {name: ASC}) { items { name sku price_range { minimum_price { regular_price { value currency } final_price { value currency } discount { amount_off percent_off } } maximum_price { regular_price { value currency } final_price { value currency } discount { amount_off percent_off } } } } } }
Adobe's page lists 2.4.4 - 2.4.8-p2 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-66120. On Cloud, add ACSD-66120 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-66120/ 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
magento/magento2-base >=2.4.4 <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, 2.4.7-p10, 2.4.7-p9, 2.4.7-p8, 2.4.7-p7, 2.4.7-p6, 2.4.7-p5, 2.4.7-p4, 2.4.7-p3, 2.4.7-p2, 2.4.7-p1, 2.4.7, 2.4.6-p15, 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6, 2.4.5-p17, 2.4.5-p16, 2.4.5-p15, 2.4.5-p14, 2.4.5-p13, 2.4.5-p12, 2.4.5-p11, 2.4.5-p10, 2.4.5-p9, 2.4.5-p8, 2.4.5-p7, 2.4.5-p6, 2.4.5-p5, 2.4.5-p4, 2.4.5-p3, 2.4.5-p2, 2.4.5-p1, 2.4.5, 2.4.4-p18, 2.4.4-p17, 2.4.4-p16, 2.4.4-p15, 2.4.4-p14, 2.4.4-p13, 2.4.4-p12, 2.4.4-p11, 2.4.4-p10, 2.4.4-p9, 2.4.4-p8, 2.4.4-p7, 2.4.4-p6, 2.4.4-p5, 2.4.4-p4, 2.4.4-p3, 2.4.4-p2, 2.4.4-p1, 2.4.4
- 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, 2.4.7-p10, 2.4.7-p9, 2.4.7-p8, 2.4.7-p7, 2.4.7-p6, 2.4.7-p5, 2.4.7-p4, 2.4.7-p3, 2.4.7-p2, 2.4.7-p1, 2.4.7, 2.4.6-p15, 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6, 2.4.5-p17, 2.4.5-p16, 2.4.5-p15, 2.4.5-p14, 2.4.5-p13, 2.4.5-p12, 2.4.5-p11, 2.4.5-p10, 2.4.5-p9, 2.4.5-p8, 2.4.5-p7, 2.4.5-p6, 2.4.5-p5, 2.4.5-p4, 2.4.5-p3, 2.4.5-p2, 2.4.5-p1, 2.4.5, 2.4.4-p18, 2.4.4-p17, 2.4.4-p16, 2.4.4-p15, 2.4.4-p14, 2.4.4-p13, 2.4.4-p12, 2.4.4-p11, 2.4.4-p10, 2.4.4-p9, 2.4.4-p8, 2.4.4-p7, 2.4.4-p6, 2.4.4-p5, 2.4.4-p4, 2.4.4-p3, 2.4.4-p2, 2.4.4-p1, 2.4.4
- Patch file
- patches/os/ACSD-66120_2.4.6-p9.patch
- vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/Price/Discount.php
- vendor/magento/module-catalog-rule/Model/Indexer/ProductPriceCalculator.php
- vendor/magento/module-catalog-rule/Pricing/Price/CatalogRulePrice.php
- vendor/magento/module-tax/Model/Calculation/UnitBaseCalculator.php
