Invert shipping rate position with VAT field As described in this post I'd like to invert the row between shipping service and VAT calculation.

I don't know how to use that hook... Can someone tells me more?

Thanks!

EDIT:
I followed the example.
I created the module, it's active and running but I see that nothing happens.

I tell you what I did (it's all in italian):
 - Created posizione_iva.info file with this content

core = "7.x"
description = "Modulo che sposta la riga dell'IVA dopo tutti i valori imponibili."
name = "Posizione IVA"



Created posizione_iva.module and copied the function


I have a doubt about this condition  if (substr($name, 0, 3) == 'iva')
Where can I find the right component name? I tried vat, VAT, iva, tax...

I use the default Drupal Commerce Kickstart installation and the "tax" module.
I assume that you know how to create a module and what a hook is, you can use hook_commerce_price_component_type_info_alter like this:

&lt;?php
function mymodule_checkout_commerce_price_formatted_components_alter(&amp;$components, $price, $entity) {
  if (isset($components['commerce_price_formatted_amount']['weight'])){

    // Get the row weight of total sum.
    $last_weight = $components['commerce_price_formatted_amount']['weight'];

    // Increase the row weight of the total row, so we can place the vat directly before.        
    $last_weight = $last_weight + 100;
    $components['commerce_price_formatted_amount']['weight'] = $last_weight;
  }

  if (is_array($components) &amp;&amp; count($components)&gt;0){
    foreach ($components as $name =&gt; &amp;$component){

      // Set the weight of the VAT row to the last position before the total sum.
      if (substr($name, 0, 3) == 'vat'){
        $component['weight'] = ($last_weight-1);
      }          
    }
  }

  return;
}