Closed
Description
Steps to reproduce:
- Create 2 categories with 1 product each
- run query to fetch products in those categories
{
products(filter: {category_id: {in: <"<cat1>", "<cat2>">}}) {
items {
sku
name
}
total_count
}
}
Expected:
total_count should be 2, and items should contain 2 products
Actual:
total_count is 2, but items only contains 1 products
Some investigation:
Changes to \Magento\CatalogGraphQl\Model\Resolver\Products\SearchCriteria\CollectionProcessor\FilterProcessor\CategoryFilter::apply() cause the product collection to be filtered by only the last category id in the array used for "in".
see $collection->addCategoryFilter($category); on line 64
Tests failed to catch this because they check total_count but not actual count of items
need to fix test: \Magento\GraphQl\Catalog\ProductSearchTest::testFilteringForProductsFromMultipleCategories()
Metadata
Metadata
Assignees
Labels
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 4. Acknowledged. Issue is added to backlog and ready for developmentPartners acceleration programA defect with this priority could have functionality issues which are not to expectations.Indicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branchAffects critical data or functionality and forces users to employ a workaround.
Type
Projects
Status
Done