[僅限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
magento/quality-patches套件更新至最新版本,並在Quality Patches Tool上檢查相容性:搜尋修補程式頁面。 使用修補程式ID作為搜尋關鍵字,以尋找修補程式。問題
當目錄價格設定為包含稅捐時,GraphQL無法正確顯示折扣百分比和基本價格。 由於舍入錯誤,折扣百分比顯示為19.99%,而非設定的20%。
要再現的步驟:
-
前往「Stores > Settings > Configuration > Catalog > Catalog > Price」。
-
將 Catalog Price Scope 設定為 網站。
-
前往「Stores > Settings > Configuration > Sales > Tax > Calculation Settings」。
- 將 Tax Calculation Method Based On 設定為 單價。
- 將 Catalog Prices 設定為 包含稅捐。
- 將 Apply Discount On Prices 設定為 包含稅捐。
-
前往「Stores > Settings > Configuration > Sales > Tax > Default Tax Destination Calculation」。
- 將 Default Country 設定為 法國。
-
前往 Stores > Tax Zones and Rates > Add new Tax Rate。
- 在 Tax Identifier 欄位中輸入任何名稱。
- 在 Zip/Post Code 欄位中輸入星號(*)。
- 將 Country 設定為 法國。
- 在 欄位中輸入 20.000000 Rate Percent。
- 按一下 Save。
-
前往 Stores > Tax Rules > Add New Tax Rule。
- 在 Name 欄位中輸入任何名稱。
- 將 Tax Rate 設定為在先前步驟中新增的速率。
-
前往 Catalog > Products > Add Product。
- 在 欄位中輸入 test Product Name。
- 在 欄位中輸入 test SKU。
- 在 欄位中輸入 82.65 Price。
- 將 Tax Class 設定為 應稅貨品。
- 在 欄位中輸入 100 Quantity。
- 按一下 Save。
-
將範圍變更為 預設存放區檢視。
- 取消設定 Use Default Value 價格。
- 將 Price 設為 68.87。
- 取消設定稅捐類別上的 Use Default Value。
- 將 Tax Class 設定為 應稅貨品。
- 按一下 Save。
-
前往「Marketing > Promotions > Catalog Price Rule > Add New Rule」。
- 在 Rule Name 欄位中輸入任何名稱。
- 將 Active 設為 是。
- 將 Website 設為 主要網站。
- 將 Customer Groups 設為 全部
- 在 Actions 底下,將 Apply 設定為 套用為原始 的百分比。
- 在 欄位中輸入 20.000000 Discount Amount。
- 按一下 Save。
-
執行完整重新索引:
$ bin/magento index:reindex
- 透過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%不正確。
套用修補程式
若要套用個別修補程式,請根據您的部署方法使用下列連結:
- Adobe Commerce或Magento Open Source內部部署: Quality Patches Tool 指南中的>使用狀況Quality Patches Tool。
- 雲端基礎結構上的Adobe Commerce:雲端基礎結構上的Commerce指南中的升級和修補程式>套用修補程式。
相關閱讀
若要進一步瞭解Quality Patches Tool,請參閱: