-
Notifications
You must be signed in to change notification settings - Fork 9.4k
magento/magento2#39873: addProductsToCart mutation doesn't work as expect with a given parent_sku #39950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.4-develop
Are you sure you want to change the base?
magento/magento2#39873: addProductsToCart mutation doesn't work as expect with a given parent_sku #39950
Conversation
… a given parent_sku - adding new ConfigurableProductPrecursor
Hi @KrasnoshchokBohdan. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
… a given parent_sku - modifying ConfigurableProductPrecursor
@magento run all tests |
… a given parent_sku - Introduced comprehensive unit tests for ConfigurableProductPrecursor, covering scenarios like valid configurations, non-configurable parents, missing attributes, and missing products. Minor code adjustments were also made for improved readability and array merging in the process method.
@magento run all tests |
Description (*)
First part -
In this issue, the author mentioned that responce from
this mutation
this expected result
this actual result
let's add a configurable product to the cart from frontend


in the "quote_item" table we have 2 items
let's try this query


and in the responce, we see only the configurable product
the reason for this is
\Magento\QuoteGraphQl\Model\Resolver\CartItemsPaginated::resolve
\Magento\Quote\Model\Quote::getAllVisibleItems
(item with sku "test simple" has parent_item_id)
so maybe it's better to change the responce example on this page instead of changing the code in \Magento\Quote\Model\Quote::getAllVisibleItems
Second part -
let's add a configurable product to the cart using the "addProductsToCart" mutation
in the responce we see only "test simple", and in "quote_item" table we have only one item

so I created ConfigurableProductPrecursor to add a configurable product to the cart along with a simple product.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
1.create an empty cart the official doc
2.add a product by specifying parent_sku following the official doc
Questions or comments
Contribution checklist (*)