Here is some code that adds ajax capabilities to the cart/"add to cart"-button
<?php
function your_module_form_alter(&$form, &$form_state, $form_id) {
// Add ajax property to Add to Cart button
if (strstr($form_id, 'commerce_cart_add_to_cart_form')) {
$form['submit'] = array(
'#value' => t('add'),
'#type' => 'submit',
'#ajax' => array(
'callback' => 'your_module_form',
'wrapper' => 'block-commerce-cart-cart',
'effect' => 'fade',
'progress' => array('type' => 'throbber', 'message' => ''),
),
);
$form['#submit'][] = 'your_module_form_rebuild_submit';
}
}
function your_module_form_rebuild_submit($form, &$form_state){
$form_state['rebuild'] = TRUE;
}
function your_module_form($form, &$form_state){
global $user;
$order_id = commerce_cart_order_id($user->uid);
$cart = commerce_embed_view('commerce_cart_block', 'default', array($order_id));
$commands = array();
$commands[] = ajax_command_replace('#block-commerce-cart-cart .view-commerce-cart-block', $cart);
$commands[] = ajax_command_replace('#block-commerce-cart-cart .cart-empty-block', $cart);
$commands[] = ajax_command_after('.'.$form['#attributes']['class'][1],theme('status_messages'));
return array('#type' => 'ajax', '#commands' => $commands);
}
?>
Just add this code some where in a custom module and your cart should be actualised when an item is added.