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
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the 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:

  1. Generate an Admin token by sending a POST request to rest/V1/integration/admin/token with the admin credentials.
  2. Create a cart price rule by using the REST endpoint rest/V1/salesRules with an action condition that uses the category_ids attribute.
  3. 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.
  4. Set the condition so that Category (Children Only) is not <category_id>.
  5. Retrieve the rule through the API by sending a GET request to rest/V1/salesRules/<rule_id>.
  6. Observe the action_condition values returned in the response.

Expected results:

  1. It should be possible to create, retrieve, and update a cart price rule with the Category (Children Only) condition through the REST API.

  2. 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_condition should 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:

  1. Both condition attribute names are returned as category_ids.
  2. 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:

To learn more about Quality Patches Tool, refer to:

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