Page content

Ubercart - overriding the cart contents table on the checkout page

I have run across situations where I have needed to override the table on the checkout page of ubercart. An example is bilingual e-commerce site that I have created, in which the title is different between languages. The English title is shown by default on the checkout page, but I needed to swap that in with a Japanese title.

Doing this is a tricky process, as Ubercart bypasses a lot of Drupal APIs. I eventually figured out how to do this in a module, by overriding the cart pane theme using hook_theme_registry_alter(), and swapping out the theme function with a theme function in my own module.

In this example, my module is named belly.

Step 1: Override the default theme function using hook_theme_registry_alter()

  1. function belly_theme_registry_alter(&$themes)
  2. {
  3. $themes['cart_review_table']['function'] = 'belly_cart_review_table';
  4. }

Ubercart: Creating Line Items Tutorial (Drupal 6)

I've recently created a new module for Drupal's Ubercart e-commerce solution that required me to add a new line item to the checkout process. It was a huge headache, as the documentation is incomplete, and there are no clear explanations/tutorials on how to do this process from start to finish. So I have decided to post the process here for three reasons:

  1. To save others from having to go through the same process of having to figure it all out like I did
  2. To save the process in a central area so that I can refer back to it myself!
  3. To get feedback on parts of the process I've done incorrectly, or to add parts that I may have missed