ACP2E-4395: Gift card products can be created via API without an amount in global scope
The ACP2E-4395 patch fixes the issue where gift card products are created via API without an amount in the global scope. This patch is available when the Quality Patches Tool (QPT) 1.1.81 is installed. The patch ID is ACP2E-4395. Please note that this issue is scheduled to be fixed in Adobe Commerce 2.4.9.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.7-p8
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.5 - 2.4.8-p5
magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
Gift card products can be created via API without an amount in the global scope.
Steps to reproduce:
-
Get the gift card amount attribute ID to use in the next step:
code language-none GET /rest/V1/products/attributes/giftcard_amounts -
Create a gift card product through the API with an amount only at website scope and no amount for All Websites (
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" } ] } }
Expected results:
The request is rejected with HTTP 400 and the message: Amount for All Websites scope should be specified or Open Amount should be allowed.
Actual results:
The request returns HTTP 200, and the gift card product is created even though it has no amount in the global All Websites scope, leaving it in an invalid state.
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide