{"data":{"id":"MDVA-37234","source":"qpt","sourceRef":"magento/quality-patches@1.1.84","title":"Fixes the issue where adding an item to the cart multiple times (parallel request) for the same SKU creates a duplicate line item for the same cart ID.","categories":["Shopping Cart","Order/Checkout","GraphQL"],"components":["magento/module-quote-graph-ql","magento/module-quote"],"origin":"adobe-commerce-support","documentation":{"url":"https://experienceleague.adobe.com/en/docs/commerce-operations/tools/quality-patches-tool/patches-available-in-qpt/v1-1-3/mdva-37234-adding-item-to-cart-multiple-times-creates-duplicate-item","path":"help/tools/quality-patches-tool/patches-available-in-qpt/v1-1-3/mdva-37234-adding-item-to-cart-multiple-times-creates-duplicate-item.md","blobSha":"67507ac98320ba26a883d846673607b0c8525289","description":"Adding an item to the cart multiple times (parallel request) for the same SKU creates a duplicate line item for the same cart ID.","stepsToReproduce":"1. Create a simple product with SKU = simple1. 1. Create a customer. 1. Generate a customer token for making GraphQL request. <pre> <code class=\"language-graphql\"> mutation { generateCustomerToken( email: \"customer email\" password: \"customer password\" ) { token } } </code> </pre> 1. Use the token mentioned in step 3 to create an empty cart for the customer. <pre> <code class=\"language-graphql\"> mutation{ createEmptyCart } </code> </pre> 1. Create a script to make two addSimpleProductsToCart requests running in parallel. For example: <pre> <code class=\"language-#!/bin/bash\"> curl -X POST -H \"Content-Type: application/json\" -H \"Authorization: Bearer <YOUR_ACCESS_TOKEN>\" -d '{\"query\" : \"mutation { addSimpleProductsToCart( input: { cart_id: \\\"<YOUR_CART_ID>\" cart_items: [ { data: { quantity: 2 sku: \\\"simple1\\\" } } ] } ) { cart { items { id product { name sku } quantity } } } }\"}' http://magento2.3.local/graphql & curl -X POST -H \"Content-Type: application/json\" -H \"Authorization: Bearer <YOUR_ACCESS_TOKEN>\" -d '{\"query\" : \"mutation { addSimpleProductsToCart( input: { cart_id: \\\"<YOUR_CART_ID>\" cart_items: [ { data: { quantity: 1 sku: \\\"simple1\\\" } } ] } ) { cart { items { id product { name sku } quantity } } } }\"}' http://magento2.3.local/graphql </code> </pre> 1. Run the script.","introducedInQpt":"1.1.3","createdFor":["2.3.6","2.4.1","2.4.2"],"documentedRange":"2.3.5 - 2.3.7-p1 and 2.4.1 - 2.4.2-p1","scheduledFixRelease":"2.4.4"},"files":[{"package":"magento/magento2-base","constraint":">=2.3.5 <2.4.0","path":"patches/os/MDVA-38481_2.3.6_v2.patch","blobSha":"89015d60ca13441a8fa45644abb48bd3541f906a","url":"https://raw.githubusercontent.com/magento/quality-patches/11d565bdde197b9c7bac859a5698e99098b48457/patches/os/MDVA-38481_2.3.6_v2.patch","thirdParty":false,"modifies":[{"path":"vendor/magento/module-quote-graph-ql/Model/Cart/AddProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"},{"path":"vendor/magento/module-quote-graph-ql/Model/Resolver/AddSimpleProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"}],"packages":["magento/module-quote-graph-ql"],"hasTests":false,"applicableVersions":{"magento-community":["2.3.7-p4","2.3.7-p3","2.3.7-p2","2.3.7-p1","2.3.7","2.3.6-p1","2.3.6","2.3.5-p2","2.3.5-p1","2.3.5"],"magento-commerce":["2.3.7-p4","2.3.7-p3","2.3.7-p2","2.3.7-p1","2.3.7","2.3.6-p1","2.3.6","2.3.5-p2","2.3.5-p1","2.3.5"],"mage-os":[]},"unknownVersions":[],"requires":["MDVA-35197"],"replacedWith":null,"deprecated":false},{"package":"magento/magento2-base","constraint":">=2.4.1 <2.4.2","path":"patches/os/MDVA-37234_2.4.1.patch","blobSha":"ee401521491032db89b530003becaf8bafb60bf2","url":"https://raw.githubusercontent.com/magento/quality-patches/11d565bdde197b9c7bac859a5698e99098b48457/patches/os/MDVA-37234_2.4.1.patch","thirdParty":false,"modifies":[{"path":"vendor/magento/module-quote-graph-ql/Model/Cart/AddProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"},{"path":"vendor/magento/module-quote-graph-ql/Model/Resolver/AddSimpleProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"}],"packages":["magento/module-quote-graph-ql"],"hasTests":false,"applicableVersions":{"magento-community":["2.4.1-p1","2.4.1"],"magento-commerce":["2.4.1-p1","2.4.1"],"mage-os":[]},"unknownVersions":[],"requires":["MDVA-34469"],"replacedWith":null,"deprecated":false},{"package":"magento/magento2-base","constraint":">=2.4.2 <=2.4.2-p2","path":"patches/os/MDVA-38760_2.4.2_v3.patch","blobSha":"12160253ef66f449338e6f3c627aef2d82d7b6ae","url":"https://raw.githubusercontent.com/magento/quality-patches/11d565bdde197b9c7bac859a5698e99098b48457/patches/os/MDVA-38760_2.4.2_v3.patch","thirdParty":false,"modifies":[{"path":"vendor/magento/module-quote/Model/QuoteMutex.php","change":"added","package":"magento/module-quote"},{"path":"vendor/magento/module-quote/Model/QuoteMutexInterface.php","change":"added","package":"magento/module-quote"},{"path":"vendor/magento/module-quote/etc/di.xml","change":"modified","package":"magento/module-quote"},{"path":"vendor/magento/module-quote-graph-ql/Model/Resolver/AddProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"},{"path":"vendor/magento/module-quote-graph-ql/Model/Resolver/AddSimpleProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"}],"packages":["magento/module-quote","magento/module-quote-graph-ql"],"hasTests":false,"applicableVersions":{"magento-community":["2.4.2-p2","2.4.2-p1","2.4.2"],"magento-commerce":["2.4.2-p2","2.4.2-p1","2.4.2"],"mage-os":[]},"unknownVersions":[],"requires":[],"replacedWith":null,"deprecated":false},{"package":"magento/magento2-base","constraint":">=2.4.3 <2.4.4","path":"patches/os/MDVA-40835_2.4.3.patch","blobSha":"c95fbc907fe84f8ff078b85d1afc469730b88a19","url":"https://raw.githubusercontent.com/magento/quality-patches/11d565bdde197b9c7bac859a5698e99098b48457/patches/os/MDVA-40835_2.4.3.patch","thirdParty":false,"modifies":[{"path":"vendor/magento/module-quote/Model/QuoteMutex.php","change":"added","package":"magento/module-quote"},{"path":"vendor/magento/module-quote/Model/QuoteMutexInterface.php","change":"added","package":"magento/module-quote"},{"path":"vendor/magento/module-quote/etc/di.xml","change":"modified","package":"magento/module-quote"},{"path":"vendor/magento/module-quote-graph-ql/Model/Resolver/AddProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"},{"path":"vendor/magento/module-quote-graph-ql/Model/Resolver/AddSimpleProductsToCart.php","change":"modified","package":"magento/module-quote-graph-ql"}],"packages":["magento/module-quote","magento/module-quote-graph-ql"],"hasTests":false,"applicableVersions":{"magento-community":["2.4.3-p3","2.4.3-p2","2.4.3-p1","2.4.3"],"magento-commerce":["2.4.3-p3","2.4.3-p2","2.4.3-p1","2.4.3"],"mage-os":[]},"unknownVersions":[],"requires":[],"replacedWith":null,"deprecated":false}],"applicableVersions":{"magento-community":["2.4.3-p3","2.4.3-p2","2.4.3-p1","2.4.3","2.4.2-p2","2.4.2-p1","2.4.2","2.4.1-p1","2.4.1","2.3.7-p4","2.3.7-p3","2.3.7-p2","2.3.7-p1","2.3.7","2.3.6-p1","2.3.6","2.3.5-p2","2.3.5-p1","2.3.5"],"magento-commerce":["2.4.3-p3","2.4.3-p2","2.4.3-p1","2.4.3","2.4.2-p2","2.4.2-p1","2.4.2","2.4.1-p1","2.4.1","2.3.7-p4","2.3.7-p3","2.3.7-p2","2.3.7-p1","2.3.7","2.3.6-p1","2.3.6","2.3.5-p2","2.3.5-p1","2.3.5"],"mage-os":[]},"conditions":null,"requirements":null},"_documentation":"https://magento.watch/api","_description":"Quality patch MDVA-37234 details"}