Drupal: Commerce buy now

This CodeLet will redirect the user to checkout page when user clicks on 'Buy now' button on the product

Use the code and create a custom module

Make sure you keep the weight of the module high in "system" table


* Implements hook_form_FORM_ID_alter().
function MY_MODULE_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state, $form_id) {
$form['submit']['#attributes']['value'] = t('Buy Now');
$form['#submit'][] = '_custom_redirect_checkout';

* add to card submit form handler
* @param unknown $form
* @param unknown $form_state
function _custom_redirect_checkout($form, &$form_state) {

Is CodeLet useful?: