Drupal Commerce - Translate Order total, Shipping Information, Billing information

If you do not want to use i18n_string and i18n_field in order to translate the Order total, Shipping & Billing Information texts, that show up in the cart and on the checkout pages when using Drupal Commerce, the following hacky approach should do the trick.

First, the following funcion can be used in your template.php file:

* Implements hook_form_alter();
function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {
// Fix order total translation
if (isset($form['cart_contents'])){
$form['cart_contents']['cart_contents_view']['#markup'] = str_replace('Order total', t('Order total'), $form['cart_contents']['cart_contents_view']['#markup']);
// Fix translation on checkout form
if ($form['#id'] == 'commerce-checkout-form-checkout'){
$form['customer_profile_billing']['#title'] = t('Billing information');
    if (isset(
$form['customer_profile_shipping']['#title'] = t('Shipping information');
// Fix translation on checkout review
if ($form['#id'] == 'commerce-checkout-form-review'){
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_billing']['title'] = t('Billing information');
    if (isset(
$form['checkout_review']['review']['#data']['customer_profile_shipping']['title'] = t('Shipping information');

The above function (as seen in https://drupal.org/node/1451132#comment-6437052 ) is also available as a module and can be used instead: https://github.com/kaido24/commerce_lang_repair

In addition, there is this patch, that will also handle the Order total text in the cart:


Drupal 7, Drupal Commerce, Drupal Quick Tips

Recent Comments

Forward by Dries Buytaert, Founder and Project Lead, Drupal; CTO Acquia.

Order now from:

Managing Expectations Podcast with DrupalEasy

Author Interview http://tinyurl.com/8a8nxno

We provide the most Shiny Drupal Bits & Pixels

Since Drupal 4.x