I'm trying to figure out how to add a bundled product to cart programmatically in Magento 2 with custom options.
In Magento 1 I could achieve it with the following
$params = array(
'product' => 14,
'related_product' => null,
'bundle_option' => array(
13 => 23,
20 => 24,
14 => 25,
16 => array(
0 => 21,
1 => 12,
),
),
'options' => array(
5 => 'Some Test value to a text field',
),
'qty' => 1,
);
$cart = Mage::getSingleton('checkout/cart');
$product = new Mage_Catalog_Model_Product();
$product->load(14);
$cart->addProduct($product, $params);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);