I'd like to modify the current order layout visible at user/[uid]/orders/[order_id]

Specifically, I'd like to list the billing and shipping info before the line item detail:

  1. billing and shipping
  2. List item detail
  3. subtotals

I know that the the line item detail is a View that can be edited, but I'm not sure how to control placement/sequence of items not in this view.

Thanks in advance for any tips or advice.

2 Answers 2


For reference there are a couple answers depending on the situation. The order of the field display can be controlled by going to store->configuration->order settings->Manage Display which I believe would solve the OP question.

If you are looking to setup a custom .tpl.php file I wasn't able to successfully use the template suggestions which are:

  • commerce_order
  • commerce_order__commerce_order
  • commerce_order__commerce_order__customer
  • commerce_order__OID (where OID is the order ID)

I found these in template_preprocess_entity in $variables['theme_hook_suggestions']

However, since an order is an entity I was able to use http://drupal.org/node/1238606 (tutorial on theming custom entities) and use a template of my own choosing.


* Process variables for MYTEMPLATE--order.tpl.php.
function MYTHEME_preprocess_MYTEMPLATE(&$variables) {
  // This is the generic entity preprocessor

 * Implements hook_entity_view_alter to alter the entity theme used by
 * commerce_order.
function MYTHEME_entity_view_alter(&$build, $type) {
  if('commerce_order' == $type){
    $build['#theme'] = 'MYTEMPLATE';

From there you can use: sites/all/modules/entity/entity.tpl.php as a template for your template.

Hope this helps someone.




If you create a new .tpl that follows the orders path you will be able to expose whatever you want in whatever order you wish. Unless I'm misreading what you're asking.

  • I wasn't able to get a template working (tried commerce-order.tpl.php, based on a quick look with devel themer). This might not have been the right name to use....
    – Dave Bruns
    Commented Aug 21, 2012 at 5:20
  • I haven't seen commerce-order yet and only commerce-order-email.tpl.php so I would say that isn't the correct theming standard for that. Most of the time it's something like users-order, or page-order something like that.
    – o_O
    Commented Aug 21, 2012 at 5:26
  • Sorry, hit return and posted a partial reply... In the end, I went with another module, commerce_invoice_receipt, which is a better solution for what I was trying to do (theme a printable version of an order). This module adds a new display to the order entity, which makes it possible for admins and users to print an HTML order that can be customized with a provided template. Also makes it possible to email the HTML order to a user manually or with a rule.
    – Dave Bruns
    Commented Aug 21, 2012 at 5:34
  • Ah. It sounded like you were aiming at theming the user's invoice view under their profile.
    – o_O
    Commented Aug 21, 2012 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.