Hello,

I wonder how can I reorder the order total lines as I want. By default, It's like the attached screenshot, which is really confusing for the user. I would like to do 2 things :

  • Reorder lines
    I would like to put the Colissimo shipping rate before the tax. Because the shipping price is displayed excluding taxes, so it should be displayed before
  • Rename the shipping rate
    I would like to mention that the shipping rate is excluding taxes. I found that I can change that name in the shipping rule, but if I add "excluding taxes" here, it will be displayed like that on the frontend too, when the user choose a shipping rate (on the frontend, they are displayed including taxes). So I think the "excluding taxes" mention should not be in the label (or create 2 label, one including taxes and one excluding taxes in the rule configuration

Thank you in advance to point me in the right direction.

Regards,

Alex

CommentFileSizeAuthor
Capture.PNG5.76 KBzmove

Comments

rszrama’s picture

Status: Active » Closed (fixed)

Hey zmove, good to see ya! If you're fine with a simple alter hook, you can use hook_commerce_price_formatted_components_alter() to move them around after the list has been built. Otherwise use hook_commerce_price_component_type_info_alter() to adjust the weights used to establish the initial sorting. : )

zmove’s picture

Hello Ryan,

As you can see, I'm returning to drupal and I'm testing Drupal commerce that seems to be awesome.

I have to work on a small ecommerce website that needs to be online really soon, and I don't have time to look into the code at the moment (that's why I ask some stupid questions ^^), but I created a special testing install for the learning, so you will see me more and more.

My first reflex was to look into the order entity, under the display options of the order total field. But when I saw that the field didn't have any display options (yet ? ^^) I was pretty sure that the salvation would be into a theme function or a hook.

Thank you for your answer. For my experience in Ecommerce, customers often want to tweak that order total lines, especially in Europe where the taxes are a nightmare to understand (for sellers and for buyers ^^). It would be a real added value to make it possible to order it in the UI. In all case, I will keep that hook on my bedside book as I will probably use it on all my future project.

rszrama’s picture

Yeah, I thought there was a UI module for this but I didn't find it on a quick search. The hook is easy enough for devs, but I agree a UI would be nice. The main challenge is sites with a lot of taxes or shipping services could end up with a looot of price component types, making it hard (or impossible) to manage through the UI. A small contrib could probably catch a majority of the use cases, though. I'm sure it'll show up eventually if I don't get to it before anyone else does. : P

pyxio’s picture

Issue summary: View changes

hi ryan,

i just came across this need and was curious if such a module or hook code example exists yet. thanks!

pyxio’s picture

Thanks kenorb!

oncreative’s picture

at #3 - Well five years later and this is still an issue. Has anyone got an example of fixing this?

romdouze’s picture

Hi oncreative,

as mentionned in https://www.drupal.org/node/1473312,

i used this module https://www.drupal.org/project/commerce_price_extra

so i can change the display of order price components in order total (in checkout or "tunnel d'achat" comme on dit en français!)

Hope this will be helpfull,

Have a nice day !
Romain