Seen a lot of references to the hook_form_alter function on how to apply this, but many of the posts are aimed at more seasoned developers. I know enough to know that I need either a custom module to change these, but I don't know where to find the form id's on the buttons to change.

I was also pointed in the direction of the StringOverrides module, but this doesn't effect the changes I want on the buttons, only where the terms I want appear in plain text, as opposed to what I'm learning is hard-coded into the Commerce Modules.

So...a) how do I find the form ids to make a module to change these buttons? and b) how to get String Overrides to actually change the text on the buttons?

1 Answer 1


The fields I was trying to change ended up being hard-coded into drupal commerce, such that string Overrides, and even the Commerce Cart Overrides modules didn't help me get done what I needed to do completely.

So...I applied the hook_form_alter() functions in the bartik theme, because I couldn't get them to work in a stand alone module, although from what I read this would be better practice and then you don't have to remember what you changed where if you want to change themes etc.

So, combination approach got done what I needed in the end. Have to say, overall documentation is pretty opaque for a relatively easy fix and from googling, a relatively around a common problem.

Code snippet that might help:

function bartik_form_alter(&$form, &$form_state, $form_id){
if (commerce_form_callback($form_id, $form_state) == "commerce_cart_add_to_cart_form"){
$form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value']=t("Add to Inquiry List");
if(strpos($form_id, 'views_form_commerce_cart_form_default')===0){
$form['actions']['submit']['#value'] = t("Update List");
$form['actions']['checkout']['#value'] = t("Submit List");
if(strpos($form_id, 'commerce_checkout_form_checkout')===0){
    $form['buttons']['continue']['#value'] = t('Proceed to final list submission.');
if(strpos($form_id, 'commerce_checkout_form_review')===0){
    $form['buttons']['continue']['#value'] = t('Submit your inquiry list');


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.