How to empty the cart automatically before adding a new item to the cart? How to empty the cart automatically before adding a new item to the cart in ubercart ver 6?

Is it possible adding uc_cart_empty($cart_id) ; in uc_cart module?
You can clear the cart using the following function

uc_cart_empty(uc_cart_get_id());


Use the above function in your module when you want clear cart. 
To empty the cart automatically before adding a new item to the cart call the function in hook_add_to_cart(). 

eg: 

function MODULE_NAME__add_to_cart($nid, $qty, $data) {
  uc_cart_empty(uc_cart_get_id());
  drupal_set_message("Previous item cleared");
}