ACP2E-4395:可透過API建立禮卡產品,全球範圍內不需使用任何金額

ACP2E-4395修補程式修正了透過API建立禮品卡產品,而全球範圍內沒有金額的問題。 安裝Quality Patches Tool (QPT) 1.1.81時,即可使用此修補程式。 修補程式ID為ACP2E-4395。 請注意,此問題已排程在Adobe Commerce 2.4.9中修正。

受影響的產品和版本

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

  • Adobe Commerce (所有部署方法) 2.4.7-p8

與Adobe Commerce版本相容:

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

問題

禮卡產品可以透過API建立,不需要全球範圍內的金額。

要再現的步驟

  1. 取得禮卡金額屬性ID以用於下一個步驟:

    code language-none
    GET /rest/V1/products/attributes/giftcard_amounts
    
  2. 透過API建立禮品卡產品,其金額僅在網站範圍內,且沒有金額適用於​所有網站 (website_id = 0):

    code language-none
    POST /rest/V1/products
    {
        "product": {
            "sku": "test-giftcard-bug",
            "name": "Test Gift Card",
            "attribute_set_id": 4,
            "status": 1,
            "visibility": 4,
            "type_id": "giftcard",
            "price": 0,
            "extension_attributes": {
                "website_ids": [1],
                "stock_item": {
                    "qty": 1000,
                    "is_in_stock": true,
                    "manage_stock": false,
                    "use_config_manage_stock": false
                },
                "giftcard_amounts": [
                    { "website_id": 1, "value": 50, "attribute_id": <attribute_id> }
                ]
            },
            "custom_attributes": [
                { "attribute_code": "giftcard_type", "value": "0" },
                { "attribute_code": "allow_open_amount", "value": "0" },
                { "attribute_code": "is_redeemable", "value": "1" }
            ]
        }
    }
    

預期結果

要求已以HTTP 400拒絕,且訊息: 應指定所有網站的金額範圍,或應允許開啟金額

實際結果

要求會傳回HTTP 200,而且即使禮卡產品在全域​ 所有網站 ​範圍中沒有金額,也會建立該產品,使其處於無效狀態。

套用修補程式

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

相關閱讀

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

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