Skip to content

Commit 8f64121

Browse files
author
Roman Lytvynenko
committed
Merge branch 'MC-25265' of https://github.com/magento-tango/magento2ce into 2.4-develop
2 parents 90a479f + 85a9cd3 commit 8f64121

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,9 @@ private function getChildrenCategories(int $categoryId): array
21212121
if (in_array($category['parent_id'], $categoryIds)
21222122
&& in_array($category['parent_id'], $anchorCategory)) {
21232123
$categoryIds[] = (int)$category[$linkField];
2124-
if ($category['is_anchor'] == 1) {
2124+
// Storefront approach is to treat non-anchor children of anchor category as anchors.
2125+
// Adding their's IDs to $anchorCategory for consistency.
2126+
if ($category['is_anchor'] == 1 || in_array($category['parent_id'], $anchorCategory)) {
21252127
$anchorCategory[] = (int)$category[$linkField];
21262128
}
21272129
}

0 commit comments

Comments
 (0)