How to check if a user has any previous order? I am working on Drupal Commerce site. Want to know if the customer is new or old. If customer has previously ordered any item from our website we can consider him old customer else if he is ordering first time he will be considered the new customer.

How can I get these values in a custom module?
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.