I want to add bundle products with quantity dynamically into cart. I am able to add products but quantity is not updated. it is always 1. Is there any way to solve this issue.
below code i am using for that.
$product = $this->_productRepository->getById(89,false, null, true); $bundle_option = [ 1 => array(2,8,18) ]; // 2,8,18 are selection ids, 1 is option id $bundle_qty = [ 1 => array(2,3,4) ]; // 2,3,4 are quantity, 1 is option id $params = [ 'form_key' => $this->formKey->getFormKey(), 'product' => 89, 'bundle_option' => $bundle_option, // it is working fine 'bundle_option_qty' => $bundle_qty, // logically it will work but in my case it is not working. 'qty' => $totalqty ]; $this->cart->addProduct($product, $params); $this->cart->save();
Please help. Thanks in advance.