fix items getChilderen returns empty array for parent cart items when… #39793
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 (*)
This pull request addresses a known issue in Magento Checkout where child products are not displayed correctly when the cart contains more than 20 products and pagination is enabled. the issue is that
$_item->getHasChildren()
returnsNULL
and$_item->getChilderen()
returnsNULL
for configurable products when the cart is paginated.To fix this, I've implemented the following changes:
updateCollectionWithQuoteItems
Method: This method iterates over the items in the collection and updates them with the corresponding quote items. It ensures that the correct items are displayed in the cart, even when pagination is active.These changes ensure that
$_item->getHasChildren()
returnstrue
for configurable products, and$_item->getChildren()
returns the correct array of child items, regardless of pagination status. This resolves the issue described in #34507 and improves the reliability of the checkout process.Fixed Issues (if relevant)
Related Pull Requests
35739
Manual testing scenarios (*)
$_item->getHasChildren()
property in theMagento_Checkout/cart/item/default.phtml
template.Expected result
The cart should behave as expected even when underlying code is calling for childeren of a products i.e.
$_item->getHasChildren()
and$_item->getChilderen()
.