Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.2
Component:
Checkout
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Mar 2012 at 16:47 UTC
Updated:
23 Nov 2017 at 13:44 UTC
Jump to comment: Most recent
Comments
Comment #1
rszrama commentedYou should get by with hook_commerce_price_formatted_components_alter(). These components can be reordered through there or through the weights of the price component types themselves (alterable through hook_commerce_price_component_type_info_alter()). There is no UI for this.
Comment #2
4kant commentedThanks Ryan,
wouldn´t it be worth called a "feature request" then?
Either as a UI or at least a more lightweight solution than coding?
Comment #3
rszrama commentedI wouldn't mind a contrib providing the UI at this point, but I'm not sure we need to have (or have a place for) a core UI at the moment. There are many elements of Drupal Commerce that are intended to be customized through code still, and we need to get a good consensus on just how much needs to be UI configurable in the core project. See for example defining / reordering order states and statuses.
Comment #5
_paul_meta commentedI agree there should be a UI means to rename and order price components
Comment #6
JemBijoux commentedJust FYI - While working through some similar issues, I found Commerce Price Extra.
Looks like it does exactly what you (and I) need:
Comment #7
amillionmonkeys commentedHi there,
Drupal newbie here. I'm sure for you developer types this is all pretty easy, but for us mere mortals, all this hook stuff is pretty tricky. Any chance anyone could show me an example of how to use hook_commerce_price_component_type_info_alter(). I am desperate to acheive exactly what Wiegand describes here. Or Wiegand could you let me know if you managed this?
Comment #8
4kant commentedHi Phil,
how come you´re a drupal newbie being a member for more than 4 years? ;-)
I´m sorry I can´t tell you anything of having succeeded in this. I think I found a way in my project the display wasn´t necessary any more.
But what about the solution being mentioned by #6?
If you you should follow this advice could you please post what you achieved there in this issue?
Thanks in advance!
Comment #9
amillionmonkeys commentedLOL! I dabbled four years ago, but was recently made redundant so now I'm trying to make a living.
Unfortunately the solution in #6 doesn't work for me... Long story. I'm sure if I was a decent developer I'd have it done in a jiffy using the hook Ryan mentioned above, unfortuantely I am not :-(
Comment #10
meecect commentedI did something like this. Here is my code:
It's part of a custom module of ours called t_checkout_mods. It looks for a particular price component, and if it finds it, it moves it to the bottom of the list, right above the order total. It could be simpler, but I was trying to code it in a very generic way, like not assuming what the 'order total' component is named, and not assuming the total has a specific weight, etc.
Comment #11
kenorb commentedSome simpler example:
If you're using view for checkout, then you've to use hook_commerce_price_formatted_components_alter(), so e.g.:
Comment #12
tj99ay commentedFor those in Australia what worked for me was adding this to your template.php file:
That then gave me everything displaying as:
Subtotal $105.00
Express Shipping $18.18
GST $12.32
Order total $135.50
My machine name was "my_gst" for the tax type and you can get this machine name from:
Store > Configuration > Tax Types
under the "Name" column in little letters eg. "GST (Machine name: my_gst)"
Hope that helps someone else out there.
Comment #13
RAWDESK commentedIf you want re-ordering fixed both in commerce front office as backoffice, you need respectively both #12 and #11 to solve it.
Worked for me.
Comment #14
uschi_glas commented#12 works like a charm. Thank you!
Comment #15
maxplus commentedThanks,
#12 solved this issue for me!
Comment #16
BITANUBE commentedThanks,
+100 points to #11
Comment #17
nikolino commentedI'm using Commerce VAT, do you know where I can find the Machine name?
Thank you!
Comment #18
pierre-nono commentedThis module can be useful too:
https://www.drupal.org/project/commerce_price_extra
Comment #19
joerch commentedThanks tj99ay!
#12 works for me!