What is wrong in my code for replacing the text of 'add to cart' button?
try this

/**
 * Implements hook_form_FORM_ID_alter().
 */
function MY_MODULE_form_commerce_cart_add_to_cart_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  //drupal_set_message($form_id);

  $form['submit']['#attributes']['value'] = t('Buy Now');

  /*
  $current_product = $form_state['default_product'];
  if ($current_product-&gt;type == 'product') {
    // Make alternations for products...
  }
  */

}