Wednesday, October 16, 2019

Drupal 7 / Ubercart 7 - REMOVING Shopping Cart CANCEL button



Drupal core 7.67 / Ubercart 7.x-3.13

Here's how I removed the CANCEL button from Drupal 7 checkout process

Here's what the page looked like before:




Here's what the page looked like after:



I accomplished this by altering the uc_cart.pages.inc file (a big NO-NO!), which means that if I ever upgrade the Ubercart implementation I will have to re-implement this change, as the file will (theoretically) be over-written by the new version.  So far, after 10 years of doing these types of things, nothing significantly bad has happened to me, so phhhht!

For those of you with enough guts to do it despite the dire warnings of Drupal-folk, here's how I did it:

*/
// GL 2019-10-15
//
// Request:   Remove CANCEL button from checkout process
// File:      uc_cart.pages.inc
// Line:      ~295
// Action:    Comment out the code block requesting this element
//            composed of the following eight (8) lines:
  $form['actions']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#validate' => array(), // Disable validation to prevent a new order
                            // from being created.
    '#limit_validation_errors' => array(),
    '#submit' => array('uc_cart_checkout_form_cancel'),
  );
*/

No comments:

Post a Comment