I am trying to insert to checkout/cart some bundle product with child items. I am using this code but it work only with simple product.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Catalog\Model\Product')->load(703);
$listBlock = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');
$addToCartUrl = $listBlock->getAddToCartUrl($product);
echo $addToCartUrl;
I also used this suggest
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $this->productRepository->getById("703");
$magento = array(82=>"103",82 => "112");
$par = array('product' => $product->getId(),'bundle_options' => array( 1 => $magento),'qty' => $qty);
$this->cart->addProduct($_product,$par);
$this->cart->save();
But still doesn't work. Can someone help me? Thanks