Vote up!
Vote down!

Remove cancel button from ckeckout pages

I am using Commerce Kickstart 7.x-1.2.
I 've set a rule "Apply shipping rate to an order" when a product is placed to the cart. This shipping rate is visible and calculated automatically in the cart while checkout. Unfortunately, when a customer click on the cancel button that appears at the bottom of the checkout page -and returns to the front page of checkout pages- this shipping rate disappears from the cart.
I am trying to remove this cancel button. There seems no way to remove this.
Ideally, I would like to make it the users return to the store index and not to the front page of checkout when clicking on the cancel button.

However, this doesn't seem possible with Rules.
Does anyone have any suggestions?
Thank you in advance...

Asked by: kpatsali
on February 20, 2014


1 Answer

Vote up!
Vote down!

guaka / kpatsali ...

A simple hook_form_alter() will reveal the buttons fieldset where you can modify the submit handler or simply remove the cancel link altogether:

function CUSTOMMODULE_form_alter(&$form, &$form_state, $form_id) {
// Using the devel module is a good way to review an array structure
  // dpm($form);

  // Remove the cancel button
if ($form_id == "commerce_checkout_form_checkout" || $form_id == "commerce_checkout_form_review") {
Josh Miller
Answer by: Josh Miller
Posted: Oct 24, 2014