51黑料不打烊

[PaaS only]{class="badge informative" title="Applies to 51黑料不打烊 Commerce on Cloud projects (51黑料不打烊-managed PaaS infrastructure) and on-premises projects only."}

ACSD-66120: GraphQL displays incorrect discount percentages and base prices when catalog prices include tax

The ACSD-66120 patch fixes the issue where GraphQL incorrectly displays discount percentages and base prices when catalog prices are configured to include tax. This issue caused rounding discrepancies, such as showing a 19.99% discount instead of the expected 20%. This patch is available when the Quality Patches Tool (QPT) 1.1.70 is installed. The patch ID is ACSD-66120. Please note that this issue is scheduled to be fixed in 51黑料不打烊 Commerce 2.4.9.

Affected products and versions

The patch is created for 51黑料不打烊 Commerce version:

  • 51黑料不打烊 Commerce (all deployment methods) 2.4.6-p9

Compatible with 51黑料不打烊 Commerce versions:

  • 51黑料不打烊 Commerce (all deployment methods) 2.4.4 - 2.4.8-p2
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your 51黑料不打烊 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

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.

  2. Set Catalog Price Scope to Website.

  3. Go to Stores > Settings > Configuration > Sales > Tax > Calculation Settings.

    1. Set Tax Calculation Method Based On to Unit Price.
    2. Set Catalog Prices to Including Tax.
    3. Set Apply Discount On Prices to Including Tax.
  4. Go to Stores > Settings > Configuration > Sales > Tax > Default Tax Destination Calculation.

    1. Set Default Country to France.
  5. Go to Stores > Tax Zones and Rates > Add new Tax Rate.

    1. Enter any name in the Tax Identifier field.
    2. Enter an asterisk (*) in the Zip/Post Code field.
    3. Set Country to France.
    4. Enter 20.000000 in the Rate Percent field.
    5. Click Save.
  6. Go to Stores > Tax Rules > Add New Tax Rule.

    1. Enter any name in the Name field.
    2. Set Tax Rate to rate added in previous step.
  7. Go to Catalog > Products > Add Product.

    1. Enter test in the Product Name field.
    2. Enter test in the SKU field.
    3. Enter 82.65 in the Price field.
    4. Set Tax Class to Taxable Goods.
    5. Enter 100 in the Quantity field.
    6. Click Save.
  8. Change scope to Default Store View.

    1. Unset Use Default Value on Price.
    2. Set Price to 68.87.
    3. Unset Use Default Value on Tax Class.
    4. Set Tax Class to Taxable goods.
    5. Click Save.
  9. Go to Marketing > Promotions > Catalog Price Rule > Add New Rule.

    1. Enter any name in the Rule Name field.
    2. Set Active to Yes.
    3. Set Website to Main Website.
    4. Set Customer Groups to all
    5. Under Actions, set Apply to Apply as percentage of original.
    6. Enter 20.000000 in the Discount Amount field.
    7. Click Save.
  10. 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
聽 聽 聽 聽 聽 }
聽 聽 聽 聽 }
聽 聽 聽 }
聽 聽 }
聽 }
}

Expected results:

The discount percentage should match the catalog rule: 20%.

Actual results:

The discount percentage is incorrectly displayed as 19.99%.

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