Code Recipes

Change "Delete" on your Cart to X

* Implements hook_form_alter().
* Designed to be added to your template.php in your custom theme.
function themename_form_alter(&$form, $form_state, $form_id) {

  switch ($form_id)  {
    case 'views_form_commerce_cart_form_default':
      foreach ($form['edit_delete'] as $row_id => $row) {
          $form['edit_delete'][$row_id]['#value'] = 'X';

Customize Checkout Look and Feel

There was a recent commit that made the checkout process table-less in the Commerce Issue Que. It was reverted in favor of making such a large change to the codebase on a 2.x release. That code still exists and it's all possible using theme_ functions in your template.php...

  1. Step 1 - Go here /modules/checkout/includes/ and look for functions that start with theme_
  2. Step 2 - Add those functions that you want to your template.php in your theme or a custom module
  3. Step 3 - change the function word "theme" with your theme name or module name.
  4. Step 4 - Make an obvious change or two
  5. Step 5 - Clear all caches and then go through the checkout process.

Let us know in the comments if this process worked for you! Also, post any tweaks to the Commerce Issue Que and they might be considered for inclusion for the 2.x release.

Function that tells us if the items in Shopping Cart / Basket

// Provided by stevetook in the forums.
function items_on_cart() {
  global $user;
  $cart = commerce_cart_order_load($user->uid); 
  $line_items = count($cart->commerce_line_items) ? TRUE : FALSE;
  return $line_items;