Skip to content

Commit

Permalink
Merge pull request #89 from riha112/3541
Browse files Browse the repository at this point in the history
[3541] Bundle option qty
  • Loading branch information
carinadues authored Oct 14, 2021
2 parents 69f56ab + 81e0d5f commit 07f5fe2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Model/Quote/Item/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Magento\Framework\DataObject;
use Magento\Quote\Api\Data\CartItemInterface;
use Magento\Quote\Model\Quote\Item;
use Magento\Catalog\Model\Product\Type as ProductType;

class Processor extends SourceProcessor
{
Expand All @@ -37,7 +38,18 @@ public function prepare(Item $item, DataObject $request, Product $candidate): vo
if ($request->getResetCount() && !$candidate->getStickWithinParent() && $item->getId() == $request->getId()) {
$item->setData(CartItemInterface::KEY_QTY, 0);
}
$item->addQty($candidate->getCartQty());

$parent = $item->getParentItem();

if ($candidate->getTypeId() !== ProductType::TYPE_BUNDLE
&& $parent
&& $parent->getProductType() === ProductType::TYPE_BUNDLE
) {
$item->setQty($candidate->getCartQty());
} else {
$item->addQty($candidate->getCartQty());
}


if (!$item->getParentItem() || $item->getParentItem()->isChildrenCalculated()) {
$item->setPrice($candidate->getFinalPrice());
Expand Down

0 comments on commit 07f5fe2

Please sign in to comment.