Magento reload/refresh top mini cart programmatically. This can be useful when you are using ajax to add/remove product to cart and want to reflect that item changes in the top cart immediately. Simply put below code where you are modifying cart programmatically and it will start working.

Right now it’s only coded for simple and configurable products, but you can add bundle, group, virtual and downloaded product item renderers too if you are using them on your website.

1
2
3
4
5
6
$b = $this->getLayout()
->createBlock('checkout/cart_sidebar')
->addItemRender('simple', 'checkout/cart_item_renderer', 'checkout/cart/sidebar/default.phtml')
->addItemRender('configurable', 'checkout/cart_item_renderer_configurable', 'checkout/cart/sidebar/default.phtml')
->setTemplate('checkout/cart/cartheader.phtml')
->toHtml();