i have create my custom add to cart controller my cart update but mini cart not update this is my code
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$request = $objectManager->get('\Magento\Framework\App\Request\Http');
$resultJsonFactory = $objectManager->get('\Magento\Framework\Controller\Result\JsonFactory');
$resultJson = $resultJsonFactory->create();
$product_id = $request->getParam('product_id');
$product_qty = $request->getParam('product_qty');
$id = $product_id;
$qty = $product_qty;
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($id);
$listBlock = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');
$cart = $objectManager->create('Magento\Checkout\Model\Cart');
$http = $objectManager->create('Magento\Framework\App\Response\Http');
$session = $objectManager->get('Magento\Checkout\Model\Session');
$cart->addProduct($product,array('qty' => $qty));
$cart->save();
if($session->setCartWasUpdated(true))
{
$response="success";
}
else
{
$response = "fail";
}
$http->setRedirect('checkout/cart/index')->sendResponse();
return $resultJson->setData(['success' => $response]);