Fix for config variant stock 736 #747
Fix for config variant stock 736 #747
Conversation
StockHelper to filter collection for us.
StockHelper to filter collection for us.
app/code/Magento/ConfigurableProductGraphQl/Model/Variant/Collection.php
Outdated
Show resolved
Hide resolved
foreach ($this->parentProducts as $product) { | ||
$attributeData = $this->getAttributesCodes($product); | ||
/** @var ChildCollection $childCollection */ | ||
$childCollection = $this->childCollectionFactory->create(); | ||
$childCollection->setProductFilter($product); | ||
$childCollection->addAttributeToSelect($attributeData); | ||
|
||
if (!$showOutOfStock) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@minesh93, please cover this functionality with API-functional tests
thanks
Examples:
https://github.com/magento/graphql-ce/tree/2.3-develop/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer
https://github.com/magento/graphql-ce/tree/2.3-develop/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer
Guide:
https://devdocs.magento.com/guides/v2.3/graphql/functional-testing.html
…for-config-variant-stock-736
- marked tests incomplete due to the bug with `@magentoConfigFixture`
- code style fixes
Hi @naydav, thank you for the review.
|
Hi @minesh93, thank you for your contribution! |
Description
This will show product variation if the configuration value of
cataloginventory/options/show_out_of_stock
is set to 1.Out of stock items are then filtered out via
Magento\CatalogInventory\Helper\Stock::addInStockFilterToCollection
Fixed Issues
Manual testing scenarios (*)
Create a configurable product with one of the variants being out of stock. Test with both
cataloginventory/options/show_out_of_stock
being enabled and disabled.