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