2

Today I am working on Bundle Products, Here I am trying to get the Default Quantity of child product of Bundle Product. But I am unable to get the details. Even though I debugged in product page, I am not getting results.

See My debugging child product of Bundle Product. enter image description here

I want to get the Default Quantity of Bundle Child Product as shown below pic.

enter image description here

Any help on this?

2

Finally, I achieved this by fallowing method.

public function getBundleOptions($product){

       /* $bundleOptions = $this->_options->getProduct();
        return $bundleOptions;*/
        $_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $store_id = 1;
        $options = $_objectManager->create('Magento\Bundle\Model\Option')
            ->getResourceCollection()
            ->setProductIdFilter($product->getId())
            ->setPositionOrder();
        $options->joinValues($store_id);
        $typeInstance = $_objectManager->get('Magento\Bundle\Model\Product\Type');
        $selections = $typeInstance->getSelectionsCollection($typeInstance->getOptionsIds($product), $product);
        foreach($selections as $selection){
            if($product->getSku() == $selection->getSku()){
                return $selection->getSelectionQty();
            }
        }
        return $selections;
    }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.