QUALITY PATCH

ACSD-57643: Products with custom options are incorrectly added to the shopping cart via GraphQL

Products with custom options are incorrectly added to the shopping cart via GraphQL. Quality patch ACSD-57643 for magento/module-quote applies to Magento Open Source and Adobe Commerce 2.4.6 to 2.4.6-p15.

Categories
GraphQL, Shopping Cart
Components
magento/module-quote
Origin
adobe-commerce-support
Since QPT
1.1.49

Issue

Products with custom options are incorrectly added to the shopping cart via GraphQL.

Steps to reproduce

1. Create a custom option type field for the product. 1. Generate a customer token using GraphQL. 1. Create an empty cart. 1. Add the product to the cart using the below payload: mutation { addProductsToCart( cartId: "wNVOTaE6sDCJoObZCCqikHQI3GyFaVif" cartItems: [ { quantity: 1 sku: "24-MB01" entered_options: [{ uid:"Y3VzdG9tLW9wdGlvbi8x", value:"product1 option1 " }] }, { quantity: 1 sku: "24-MB01" entered_options: [{ uid:"Y3VzdG9tLW9wdGlvbi8x", value:"product2 option1" }] } { quantity: 3 sku: "24-MB01", entered_options: [{ uid:"Y3VzdG9tLW9wdGlvbi8x" value:"product3 option1" }] } ] ) { cart { items { product { name sku } ... on SimpleCartItem { customizable_options { customizable_option_uid label values { customizable_option_value_uid value } } } quantity } } user_errors { code message } } } 1. You will see that the product is added only once: { "data": { "addProductsToCart": { "cart": { "items": [ { "product": { "name": "Joust Duffle Bag", "sku": "24-MB01" }, "customizable_options": [ { "customizable_option_uid": "Y3VzdG9tLW9wdGlvbi8x", "label": "Option1", "values": [ { "customizable_option_value_uid": "Y3VzdG9tLW9wdGlvbi8x", "value": "product1 option1" } ] } ], "quantity": 5 } ] }, "user_errors": [] } } }

Adobe's page lists 2.4.6 - 2.4.6-p7 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.

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-57643. On Cloud, add ACSD-57643 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-57643/ 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

Packages across compatible versions (1): magento/module-quote
Packages across compatible versions (1): magento/module-quote

magento/magento2-base >=2.4.6 <2.4.7

Magento Open Source
2.4.6-p15, 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-p15, 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
Patch file
patches/os/ACSD-57643_2.4.6-p3.patch
  • vendor/magento/module-quote/Model/Cart/AddProductsToCart.php

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.