magento/magento2#39873: addProductsToCart mutation doesn't work as expect with a given parent_sku #39950
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 (*)