ACP2E-4653: REST API中缺少購物車價格規則類別範圍條件

ACP2E-4653修補程式修正透過REST API擷取或更新規則時,Category (Parent Only)​和​ Category (Children Only) ​的購物車價格規則條件屬性範圍未公開的問題。 安裝Quality Patches Tool (QPT) 1.1.80時,即可使用此修補程式。 修補程式ID為ACP2E-4653。 請注意,此問題已排程在Adobe Commerce 2.4.9中修正。

受影響的產品和版本

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

  • Adobe Commerce (所有部署方法) 2.4.8-p2

與Adobe Commerce版本相容:

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

問題

透過REST API擷取或更新購物車價格規則時,Category (Parent Only)​和​ Category (Children Only) ​的屬性範圍未公開。

要再現的步驟

  1. 使用管理員認證傳送POST請求給rest/V1/integration/admin/token來產生管理員權杖。
  2. 使用REST端點rest/V1/salesRules與使用category_ids屬性的動作條件來建立購物車價格規則。
  3. 在「管理員」面板中,開啟購物車價格規則。 在​ Actions ​區段的​ Apply the rule only to cart items matching the following conditions (leave blank for all items ​下,手動新增​ Category (Children Only) ​條件。
  4. 設定條件,讓​ Category (Children Only) ​不是<category_id>
  5. 傳送GET要求給rest/V1/salesRules/<rule_id>以透過API擷取規則。
  6. 觀察回應中傳回的action_condition值。

預期結果

  1. 應可透過REST API以​ Category (Children Only) ​條件建立、擷取及更新購物車價格規則。

  2. 屬性範圍應明確公開,以便正確辨別類別、Category (Parent Only)​和​Category (Children Only)。 例如,action_condition應該傳回如下:

    code language-none
            "action_condition": {
                "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine",
                "conditions": [
                    {
                        "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product",
                        "operator": "!=",
                        "attribute_name": "category_ids",
                        "value": "4",
                        "extension_attributes": {
                            "attribute_scope": ""
                        }
                    },
                    {
                        "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product",
                        "operator": "==",
                        "attribute_name": "category_ids",
                        "value": "5",
                        "extension_attributes": {
                            "attribute_scope": "children"
                        }
                    }
                ],
                "aggregator_type": "all",
                "operator": null,
                "value": "1"
            },
    

實際結果

  1. 兩個條件屬性名稱都會傳回為category_ids
  2. 不清楚如何透過REST API建立或更新具有​ Category (Children Only) ​條件的規則。

套用修補程式

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

相關閱讀

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

recommendation-more-help
commerce-operations-help-tools