Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there a way to show the total order weight at checkout, and/or the calculated weight of each line of the order? I have a client who offers free freight for orders over 1000lbs and they would like to let the customer see total weight so they now how much more they'd need to order to qualify for free shipping. Thank you.
Comment | File | Size | Author |
---|---|---|---|
#8 | views_total_order_weight_panel_pia.txt | 4.8 KB | Roman_L |
Comments
Comment #1
gundara CreditAttribution: gundara commented+1
Comment #2
ioanmar CreditAttribution: ioanmar commented+1
Comment #3
kevster CreditAttribution: kevster commentedThis would be a great feature as although we have weight on each product line item we cant see a way to add the total weight order, +1...
Comment #4
blueblade CreditAttribution: blueblade commented+1
Comment #5
ecvandenberg CreditAttribution: ecvandenberg as a volunteer commentedI think this request is still valid. How can I help to get this going?
Comment #6
mrawat CreditAttribution: mrawat commented+1
Comment #7
zenimagine CreditAttribution: zenimagine commented+1
Comment #8
Roman_L CreditAttribution: Roman_L commentedI'm disappointed to see no answer to this. Near 5000 installs and no tip from the users nor the devs ?
Anyway, first thanks for this great module which, i think, should be a part of DC core (weight and dimensions are needed for shipping rules and price calculations!).
Let's explain how to render the total order weight in a view, and then, show this view in a panel.
You'll need two modules : views_php (see doc for enabling php text format) and commerce_views_pane.
Enable them, create a new view with format "Commerce Checkout Pane".
Add a contextual filter : Commerce order id, with default value "current user order id".
Add a new hidden field "order id".
Add a new field "global : php".
In this field enter the code below :
And voilà ! enable the pane in your order workflow and see the total order weight rendered.
You can use this code in any view where you can get the order_id (cart summary, cart, ...), in rules, custom module...
@kevster (3 years late sorry) : if you want to show, for example, each product unit weight in the cart or line items view, you must alter the views and add a "commerce product referenced by line item" relationship, then the field "commerce product : weight" will be available to add in the table.
Hope it helps, and sorry for my bad english !
With this post you'll find the view export so you can import it (beware : default language of the store i work for is French). If i have time to, i'll try to commit a patch to include the view in the module.
Comment #9
zenimagine CreditAttribution: zenimagine commentedGreat. Thank you very much.
Comment #10
mrawat CreditAttribution: mrawat commentedThanks for this @piactif
Is it possible to show order weight in the cart?
Comment #11
Roman_L CreditAttribution: Roman_L commented@mrawat yes as the shopping cart has an order id
Comment #12
sano CreditAttribution: sano commentedFor cases when one needs to use the weight in a rule:
<?php ?>
tags:from the code.