How to change the price componnents order in the order total field view I have a commerce site, I want to change the price componnents order of total order field in the order view page.

In the edit order page the last added line item -fee in my case , I add them manually- become the first in the in the price componnents field, I want do the inverse.


I didn't find any view to edit the added line items order. So I want to ask if there is a way to do that.
Implementing hook_commerce_price_component_type_info_alter hook you can change weight of price components to change sequence. Check following example:

&lt;?php
/**
* Implements hook_commerce_price_component_type_info_alter()
**/

function &lt;MODULE_NAME&gt;_commerce_price_component_type_info_alter(&amp;$components) {
  if (!empty($components['tax|tax_on_shipping'])) {
    $components['tax|tax_on_shipping']['weight'] = 30;
  }
}