0

I have Commerce and Shipping and Flat Rate installed and working correctly. Shipping is added to an Order and charged to the customer.

But when I go to display the shipping line items, e.g. in a order receipt email, they are missing.

My Rule uses this:

Order Details:
[commerce-order:commerce_line_items]

Total Price: [commerce-order:commerce_order_total]

This correctly displays each product line item, and the order total, including shipping line items, but does not display the shipping line items.

I read about a filter in the View at admin/structure/views/view/commerce_line_item_table/edit/default and I see that it is set to only display product line items. But I don't want to mess with that View unless I know what I am doing.

Can I Add a new View display? If so, which kind (Data export?) How to call that display in my Rule?

Thank you.

1 Answer 1

1

If you enable the Token module (maybe you already have?), you are given a new view mode on all fieldable entity types called Tokens. You need to enable this in the Custom display settings fieldset on the Manage display page for order types (found under Administration > Store > Configuration > Order settings). Once you've done this, you'll be able to choose any eligible View you want for rendering the line item field's tokens, so if you add another display to the default View and remove that line item type filter, you can use that just for rendering the token.

You can read more w/ screenshots here: https://www.drupal.org/node/1299662

6
  • Thanks Ryan, I get it, but what type of display should I select when adding the display to the view? Commented Jan 30, 2015 at 19:52
  • Well, I just tried a few, Block seemed to be the one. It certainly worked and I got the shipping line items in the [commerce-order:commerce_line_items] token, as I expected. That was some deep juju to accomplish what would seem to be a very common task, though ... Or am I missing something obvious? Commented Jan 30, 2015 at 20:18
  • Common task it may be, but it's not immediately obvious how it should be improved. I don't know a more explicit way given the current Field UI / Token constraints to choose different display formatters for a field based token. : ) Commented Feb 1, 2015 at 22:23
  • Ryan, can I ask what is the rationale behind not including all line item types by default? Also, if I wrote up a little tutorial on this, where should I put it? Commented Feb 2, 2015 at 9:16
  • 1
    OK. Tutorial published on my blog at websitebackendsolutions.com/blog/… . I will also update the Shipping doc page. Thanks Ryan! Commented Feb 5, 2015 at 4:54

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.