ACP2E-4653: Cart price rule category scope conditions missing from REST API
The ACP2E-4653 patch fixes the issue where the cart price rule condition attribute scope for Category (Parent Only) and Category (Children Only) is not exposed when rules are retrieved or updated through the REST API. This patch is available when the Quality Patches Tool (QPT) 1.1.80 is installed. The patch ID is ACP2E-4653. 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.8-p2
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.8 - 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
When cart price rules are retrieved or updated through the REST API, the attribute scope for Category (Parent Only) and Category (Children Only) is not exposed.
Steps to reproduce:
- Generate an Admin token by sending a
POSTrequest torest/V1/integration/admin/tokenwith the admin credentials. - Create a cart price rule by using the REST endpoint
rest/V1/salesRuleswith an action condition that uses thecategory_idsattribute. - In the Admin panel, open the cart price rule. In the Actions section, under Apply the rule only to cart items matching the following conditions (leave blank for all items, manually add a Category (Children Only) condition.
- Set the condition so that Category (Children Only) is not
<category_id>. - Retrieve the rule through the API by sending a
GETrequest torest/V1/salesRules/<rule_id>. - Observe the
action_conditionvalues returned in the response.
Expected results:
-
It should be possible to create, retrieve, and update a cart price rule with the Category (Children Only) condition through the REST API.
-
The attribute scope should be exposed explicitly so that Category, Category (Parent Only), and Category (Children Only) can be distinguished correctly. For example, the
action_conditionshould be returned as follows: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" },
Actual results:
- Both condition attribute names are returned as
category_ids. - It is not clear how to create or update a rule with the Category (Children Only) condition through the REST API.
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.