1

Hi I've been struggling with this issue for a while, look for it from google to the official Drupal Commerce documentation without any luck. So i have a cart and I am customizing the looking and the behaviour, tpl and preprocess function have been my friend until now.

I need to custom the bottom actions of the cart

enter image description here

But I haven't been able to look for a tpl and I still don't know how to change the behaviour of this actions if you can give a hint of how to:

  • Change the value of the of both of this action
  • How to add more actions.
  • How to change the behaviour of the items.

BTW. I look for it on the setting of the Views without any luck, but I'm kind of noob in drupal. Thanks!

| improve this question | | | | |
2

You need to create a custom module and use hook_form_alter to modify the form.

That particular form id is views_form_commerce_cart_form_default, so in your custom module, you could have something like this:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  //cart form
  if (strpos($form_id, 'views_form_commerce_cart_form_default') === 0) {
    //change the value
    $form['actions']['submit']['#value'] = "New Update cart value";
    $form['actions']['checkout']['#value'] = "New Check-out Value";

    //add additional callback functions on the checkout button
    $form['actions']['checkout']['#submit'][] = 'mymodule_callback';

    //replace callback functions on the checkout button
    $form['actions']['checkout']['#submit'] = array('mymodule_callback');
  }
}

Refer to the Form API Reference to see what else you can do.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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