function commerce_cart_checkout_form_cancel_submit in Commerce Core 7
Submit handler to take back the order to cart status on cancel in checkout.
1 string reference to 'commerce_cart_checkout_form_cancel_submit'
- commerce_cart_form_alter in modules/
cart/ commerce_cart.module - Implements hook_form_alter().
File
- modules/
cart/ commerce_cart.module, line 290 - Implements the shopping cart system and add to cart features.
Code
function commerce_cart_checkout_form_cancel_submit($form, &$form_state) {
// Update the order to the cart status.
$order = commerce_order_load($form_state['order']->order_id);
$form_state['order'] = commerce_order_status_update($order, 'cart', TRUE);
// Skip saving in the status update and manually save here to force a save
// even when the status doesn't actually change.
if (variable_get('commerce_order_auto_revision', TRUE)) {
$form_state['order']->revision = TRUE;
$form_state['order']->log = t('Customer manually canceled the checkout process.');
}
commerce_order_save($form_state['order']);
drupal_set_message(t('Checkout of your current order has been canceled and may be resumed when you are ready.'));
// Redirect to cart on cancel.
$form_state['redirect'] = 'cart';
}