Skip to content

$_item->getChildren() returns empty array for parent cart items when cart is paginated #34507

@samcleathero

Description

@samcleathero

Preconditions (*)

  1. PHP 7.4
  2. Magento 2.4.3-p1 (also replicated in 2.3.5-p1 and 2.4.2)

Steps to reproduce (*)

  1. Override cart item renderer template (Magento_Checkout/cart/item/default.phtml).
  2. Add $_item->getChildren() to get child items of configurable products - I am using this to get stock levels for child products when a configurable product is added to the cart. For demo purposes, I have var_dumped $_item->getHasChildren() in the screenshots below.
  3. Add enough individual products to the cart to trigger pagination in the cart (by default more than 20 products).
  4. Observe that without pagination active, $_item->getHasChildren() returns NULL for simple products, and (bool)true for configurable products. When pagination is triggered, $item->getHasChildren() returns NULL for all products, including configurables with children.

Expected result (*)

var_dump($_item->getHasChildren()) should return (bool)true for configurable products. $_item->getChildren() should also return an Magento\Quote\Model\Quote\Item\AbstractItem array. This screenshot shows it working correctly for a cart where pagination has not been triggered.

Actual result (*)

var_dump($_item->getHasChildren()) actually returns NULL for configurable products. $_item->getChildren() also returns an empty array. This screenshot is taken once enough products have been added to the cart to trigger pagination.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReported on 2.4.3-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Pull Request In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions