[僅限PaaS]{class="badge informative" title="僅適用於雲端專案(Adobe管理的PaaS基礎結構)和內部部署專案的Adobe Commerce 。"}

ACSD-66120:當型錄價格包含稅捐時,GraphQL顯示不正確的折扣百分比與基本價格

ACSD-66120修補程式修正當目錄價格設定為包含稅捐時,GraphQL無法正確顯示折扣百分比與基本價格的問題。 此問題會導致舍入不一致,例如顯示19.99%的折扣,而不是預期的20%。 安裝Quality Patches Tool (QPT) 1.1.70時,即可使用此修補程式。 修補程式ID為ACSD-66120。 請注意,此問題已排程在Adobe Commerce 2.4.9中修正。

受影響的產品和版本

已為Adobe Commerce版本建立修補程式:

  • Adobe Commerce (所有部署方法) 2.4.6-p9

與Adobe Commerce版本相容:

  • Adobe Commerce (所有部署方法) 2.4.4 - 2.4.8-p2
NOTE
此修補程式可能適用於發行版本為Quality Patches Tool的其他版本。 若要檢查修補程式是否與您的Adobe Commerce版本相容,請將magento/quality-patches套件更新至最新版本,並在Quality Patches Tool上檢查相容性:搜尋修補程式頁面。 使用修補程式ID作為搜尋關鍵字,以尋找修補程式。

問題

當目錄價格設定為包含稅捐時,GraphQL無法正確顯示折扣百分比和基本價格。 由於舍入錯誤,折扣百分比顯示為19.99%,而非設定的20%。

要再現的步驟

  1. 前往「Stores > Settings > Configuration > Catalog > Catalog > Price」。

  2. 將​ Catalog Price Scope ​設定為​ 網站

  3. 前往「Stores > Settings > Configuration > Sales > Tax > Calculation Settings」。

    1. 將​ Tax Calculation Method Based On ​設定為​ 單價
    2. 將​ Catalog Prices ​設定為​ 包含稅捐
    3. 將​ Apply Discount On Prices ​設定為​ 包含稅捐
  4. 前往「Stores > Settings > Configuration > Sales > Tax > Default Tax Destination Calculation」。

    1. 將​ Default Country ​設定為​ 法國
  5. 前往​ Stores > Tax Zones and Rates > Add new Tax Rate

    1. 在​ Tax Identifier ​欄位中輸入任何名稱。
    2. 在​ Zip/Post Code ​欄位中輸入星號(*)。
    3. 將​ Country ​設定為​ 法國
    4. 在​ 欄位中輸入 20.000000 Rate Percent
    5. 按一下​ Save
  6. 前往​ Stores > Tax Rules > Add New Tax Rule

    1. 在​ Name ​欄位中輸入任何名稱。
    2. 將​ Tax Rate ​設定為在先前步驟中新增的速率。
  7. 前往​ Catalog > Products > Add Product

    1. 在​ 欄位中輸入 test Product Name
    2. 在​ 欄位中輸入 test SKU
    3. 在​ 欄位中輸入 82.65 Price
    4. 將​ Tax Class ​設定為​ 應稅貨品
    5. 在​ 欄位中輸入 100 Quantity
    6. 按一下​ Save
  8. 將範圍變更為​ 預設存放區檢視

    1. 取消設定​ Use Default Value ​價格。
    2. 將​ Price ​設為​ 68.87
    3. 取消設定稅捐類別上的​ Use Default Value
    4. 將​ Tax Class ​設定為​ 應稅貨品
    5. 按一下​ Save
  9. 前往「Marketing > Promotions > Catalog Price Rule > Add New Rule」。

    1. 在​ Rule Name ​欄位中輸入任何名稱。
    2. 將​ Active ​設為​
    3. 將​ Website ​設為​ 主要網站
    4. 將​ Customer Groups ​設為​ 全部
    5. 在​ Actions ​底下,將​ Apply ​設定為​ 套用為原始 ​的百分比。
    6. 在​ 欄位中輸入 20.000000 Discount Amount
    7. 按一下​ Save
  10. 執行完整重新索引:

$ bin/magento index:reindex
  1. 透過GraphQL執行下列​ Store ​查詢: 預設 ​設定於標頭中:
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
          }
        }
      }
    }
  }
}

預期結果

折扣百分比應符合型錄規則:20%。

實際結果

折扣百分比顯示為19.99%不正確。

套用修補程式

若要套用個別修補程式,請根據您的部署方法使用下列連結:

相關閱讀

若要進一步瞭解Quality Patches Tool,請參閱:

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