0

I would like to customize the Commerce order admin layout, the tables shown when admin clicks View or Edit in the Orders table.

These pages are typically shown on the following URLs: yoursite/admin/commerce/orders/order_id/view and yoursite/admin/commerce/orders/order_id/edit where order_id is a number.

I want to add a custom column (a field from my product content type) to these tables. I have searched all the views which were created automatically when I installed Commerce but wasn't able to find the one which is rendering these pages.

2
  • 1
    Drupal 7 + Commerce 1 or Drupal 8 + Commerce 2?
    – m.stenta
    Oct 20, 2017 at 16:21
  • Drupal 7 + Commerce 1
    – csbt23
    Oct 22, 2017 at 20:20

1 Answer 1

-1

In Drupal 7, Commerce 1 (7.x-1.x)

  1. For the actual individual order page, you'll want to edit the view entitled "Line items (Commerce Line Item)"

    Bear in mind however, the column you add may cause errors if the field only exists for some product types and not others. You might need to add an additional relationship to the view to get the field of data.

  2. For the actual order summary page found at /admin/commerce/orders, you'll want to edit the "Orders" view. You'll probably need to add a relationship for Commerce Order Line Items.

2
  • 1
    First of all thank you very much for your answer. Adding the relationship to the "Line Items" view really helped me to display an additional field on the /admin/commerce/orders/% page. However it still does not show up on the /admin/commerce/orders/%/edit page (this is the page which opens when admin clicks on the "Edit" tab on the previous page). Additionally, on the /edit page I have the "SKU" column which I would like to remove or at least change the heading to something else but editing the Line Items (Commerce Line Item) view does not do anything with it.
    – csbt23
    Oct 23, 2017 at 15:37
  • Commerce Line Item view only edits the line items table - not the 'View' and 'Edit' pages as requested. Any ideas on this? Oct 9, 2020 at 7:24

Your Answer

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

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