Hello currently I am making a online e store using drupal Commerce so i want to change add to cart button to Buy Now So Ho Can I able To Do Help It Out

1 Answer 1


If you want to alter the text for a particular form you can alter it using hook_form_alter

Get the ID of the form for the product display where you are trying to change the text & do something like this:

function MYMODULE_form_alter(&$form, &$form_state, $form_id){//replace your module name with MYMODULE
  if(strpos($form_id, 'commerce-cart-add-to-cart-form-65') !== false){//my form ID is "commerce-cart-add-to-cart-form-65", replace it with your form ID.
    $form['submit']['#value'] = t('Buy Now');//Put the text which you want to make appear instead of "Add to cart".

You could also use String Overrides Module to achieve the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.