EmicoEcommerce / Magento2TweakwiseExport

Magento 2 module for Tweakwise export
Other
1 stars 10 forks source link

Stock behavior for grouped products #68

Open pmzandbergen opened 1 week ago

pmzandbergen commented 1 week ago

Reference: https://github.com/EmicoEcommerce/Magento2TweakwiseExport/blob/1c282a38adbdb4684a3a6ebc9aef5f4c2620b4bc/Traits/Stock/HasStockThroughChildren.php#L43

        $isInStock = min(
            max($childStockStatus),
            $this->getTypeId() === Configurable::TYPE_CODE ? 1 : $this->stockItem->getIsInStock()
        );

Shouldn't this behavior be the same for grouped products? For bundled products the default behavior is indeed out-of-stock when any of its child products is out-of-stock, otherwise you couldn't buy the bundle. For grouped products you can buy a child product(s), while other(s) are out-of-stock.

Note: I'll create an PR for this issue.

ah-net commented 1 week ago

@pmzandbergen It depends what the default behaviour is for grouped products. My understanding is that the default behaviour is that the grouped product is not available if one of the child products is out of stock. But I could be wrong. I'll test this and get back to you.

ah-net commented 2 days ago

@pmzandbergen The default behaviour is indeed that the grouped product is not out of stock if one of the items is out of stock. But i tested the export and the current code already works that way. The stock of my grouped product is the total of all children. And is only out of stock if all children are out of stock.

So i'm not sure why this needs to be changed since it seems that it currently already works that way. Can you give an example in which case the wrong result is exported?