ACP2E-4653: When cart price rules are retrieved or updated through the REST API…
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. Quality patch ACP2E-4653 for magento/module-sales-rule applies to Magento Open Source and Adobe Commerce 2.4.8 to 2.4.8-p5.
- Categories
- Shopping Cart, Web API
- Components
- magento/module-sales-rule
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.80
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. 1. Create a cart price rule by using the REST endpoint rest/V1/salesRules with an action condition that uses the category_ids attribute. 1. 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. 1. Set the condition so that Category (Children Only) is not <category_id>. 1. Retrieve the rule through the API by sending a GET request to rest/V1/salesRules/<rule_id>. 1. Observe the action_condition values returned in the response.
Adobe's page lists 2.4.8 - 2.4.8-p5 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.
Adobe scheduled the permanent fix for 2.4.9.
Install
Install the Quality Patches Tool with composer require magento/quality-patches, apply the prerequisites listed for all files applicable to your distribution and version first, then run vendor/bin/magento-patches apply ACP2E-4653. On Cloud, add ACP2E-4653 under stage.build.QUALITY_PATCHES in .magento.env.yaml.
For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACP2E-4653/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Bundle prerequisites the same way and list them first. Paths are relative to each package root, using the default -p1 level. Prefer local files when configuring composer-patches; a remote URL can change.
Patch files and compatible versions
magento/magento2-base >=2.4.8 <2.4.9
- Patch file
- patches/os/ACP2E-4654_2.4.8-p2.patch
- vendor/magento/module-sales-rule/Model/Converter/ToDataModel.php
- vendor/magento/module-sales-rule/Model/Converter/ToModel.php
- vendor/magento/module-sales-rule/Model/Data/Condition/Validator.php (added)
- vendor/magento/module-sales-rule/Model/Data/Validator.php (added)
- vendor/magento/module-sales-rule/etc/di.xml
- vendor/magento/module-sales-rule/etc/extension_attributes.xml
