How to check if a user has any previous order?
Try this method. commerce_order_load_multiple will return order

function module_user_has_order() {
    $order = commerce_order_load_multiple(array(), array('uid' =&gt; 'user_id','status' =&gt; 'completed'));
  if(empty($order)) {
    //user has no previous order.
  }
  else {
    // user has previous order.
  }
}


Hope it works for you.