ACSD-57477: Sales rule processing causes slow performance on cart-related requests…
Sales rule processing causes slow performance on cart-related requests if you send the parameters as GraphQL variables. Quality patch ACSD-57477 for magento/framework applies to Magento Open Source and Adobe Commerce 2.4.6 to 2.4.6-p14.
- Categories
- Order/Checkout, GraphQL, Shopping Cart, Performance
- Components
- magento/framework, magento/module-quote, magento/module-quote-graph-ql, magento/module-sales-rule
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.69
Issue
Sales rule processing causes slow performance on cart-related requests if you send the parameters as GraphQL variables.
Steps to reproduce
1. Add 1000 product attributes. 1. Create a cart using below GraphQL query. mutation {createEmptyCart}{noformat} 1. Add a product to cart using below GraphQL query. mutation AddProductsToCart($cartId: String!, $products: [CartItemInput!]!) { addProductsToCart(cartId: $cartId, cartItems: $products) { cart { id __typename } __typename } } 1. Set these Variables. { "cartId": "id_here", "products": [ { "sku": "product_dynamic_1", "parent_sku": "product_dynamic_1", "quantity": 1 } ] } 1. This issue occurs only when you send the parameters as GraphQL variables. If you include the parameters into the GraphQL query itself, then this issue doesn't occur. 1. Send the same Add To Cart request after adding parameters into the GraphQL query itself. mutation { addProductsToCart( cartId: "id_here" cartItems: [ { sku: "product_dynamic_1", parent_sku: "product_dynamic_1", quantity: 1 } ] ) { cart { id __typename } __typename } }
Adobe's page lists 2.4.6 - 2.4.6-p11 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.7.
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 ACSD-57477. On Cloud, add ACSD-57477 under stage.build.QUALITY_PATCHES in .magento.env.yaml.
For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACSD-57477/ 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.6 <2.4.6-p15
- Magento Open Source
- 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6
- Adobe Commerce
- 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6
- Requires
- ACSD-59865
- Patch file
- patches/os/ACSD-57477_2.4.6-p2.patch
- vendor/magento/module-quote/Model/Quote/Address.php
- vendor/magento/module-quote-graph-ql/Plugin/ProductAttributesExtender.php
- vendor/magento/module-sales-rule/Helper/CartFixedDiscount.php
- vendor/magento/module-sales-rule/Model/Quote/Discount.php
- vendor/magento/module-sales-rule/Model/ResourceModel/Rule/Collection.php
- vendor/magento/module-sales-rule/Model/Rule.php
- vendor/magento/module-sales-rule/Model/Rule/Action/Discount/CartFixed.php
- vendor/magento/module-sales-rule/Model/Validator.php
- vendor/magento/framework/GraphQl/Query/Fields.php
