In my custom module, products are going to add directly to cart as below :
foreach($productArray as $key => $id )
{
$p["qty"] = $qtyArray[$key];
try {
$params = array(
'product' => $id,
'qty' => $p
);
$_product = $this->_productRepository->getById($id);
$this->cart->addProduct($_product,$params);
$this->cart->save();
} catch(\Exception $e) {
$responseData['action']="errmessage";
$responseData['msg'] = __("Something went wrong. please correct the sku(s)");
$error = true;
}
}
A single product is added in the cart without issue but when we try to add multiple products together into the cart then the price of the first product is updated and subtotal is also updated but prices for 2nd individual products is showing 0 Any help will be appreciated! Thanks