function custom_module_form_alter(&$form, &$form_state, $form_id) {
if (strpos($form_id, 'commerce_cart_add_to_cart_form') !== false) {
if (isset($form['product_id']['#value'])) {
    $product_id = $form['product_id']['#value'];
}
else {
    $product_id = $form['product_id']['#default_value'];
}
$form['buy_now_pid'] = array(
'#type' => 'hidden',
'#name' => 'buy_now_pid',
'#default_value' => $product_id,
);
$form['buy_now_submit'] = array(
'#type' => 'submit',
'#name' => 'buy_now',
'#value' => t('Buy Now'),
'#submit' => array('custom_module_buy_now_call_back'),
'#weight' => '52',
'#attributes' => array('class' => array('btn-buy-now')),
);
}
}
Callback function to add product to cart and redirect to checkout. Callback function also handles custom functionalities while adding product to cart.




function custom_module_buy_now_call_back($form, &$form_state){
    $pid = $_REQUEST['buy_now_pid'];
    global $user;
    commerce_cart_line_item_add($pid, 1, $user->uid);
    drupal_goto('checkout');
    //Other custom functionalities....
}